[实战一]script to check outlook cach mode

简介:

'********************************************************
'*         Windows Script Source Code                   *
'*Used for Collect PPG China Site infromation ==> Audit *
'*Author: Fu Eric    eric.fu@hm.com                                  *
'*HM SITE Admin                             *                    
'*Date: 12 Oct 2013                                     *
'*Any Site can change infor depend on your request      * 
'********************************************************
On Error Resume Next

Dim ClickValue

Const HKEY_CLASSES_ROOT   = &H80000000  'HKCR
Const HKEY_CURRENT_USER   = &H80000001  'HKCU
Const HKEY_LOCAL_MACHINE  = &H80000002  'HKLM
Const HKEY_Users          = &H80000003  'HKU
Const HKEY_Current_Config = &H80000005  'HKCC


Const REG_SZ = 1           
Const REG_EXPAND_SZ = 2    
Const REG_BINARY = 3      
Const REG_DWORD = 4        
Const REG_MULTI_SZ = 7     


Const KEY_QUERY_VALUE = &H0001  
Const KEY_SET_VALUE = &H0002     
Const KEY_CREATE_SUB_KEY = &H0004
Const DELETE = &H00010000        

'''-----------------file path ----------------------------------------
strComputer = "."

Set WshShell = WScript.CreateObject("WScript.Shell")

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")

strKeyRoot = HKEY_CURRENT_USER

Regpath    = "HKEY_CURRENT_USER"

strKeyPath = "Software\Policies\Microsoft\office\14.0\outlook\cached mode"

oReg.EnumValues strKeyRoot, strKeyPath, arrValueNames, arrValueTypes

For i=0 To UBound(arrValueNames)

    If arrValueNames(i) = "Enable" Then

  oReg.GetDWORDValue strKeyRoot, strKeyPath, arrValueNames(i), strRunCommand

  if strRunCommand = 1 then 

           WshSHell.popup "Information: "& vbcrlf _
           & "===============================================" & vbcrlf & "Outlook Cache mode Enabled, You Can shutdown computer tonight! Thanks for using!" & vbcrlf & "===============================================" _
           , 30, "Developed By CN IT", 0 + 64

  else 

  WshSHell.popup "Information: "& vbcrlf _
           & "===============================================" & vbcrlf & "Outlook Cache mode Disabled, Don't Shutdown computer tonight with Outlook closed!" & vbcrlf & "===============================================" _
           , 30, "Developed By CN IT", 0 + 64


         ClickValue = MsgBox ("Do you want to CLOSE OUTLOOK Now ? ", 65, "Develop by CNIT")

         if ClickValue = 1 then 


         Set objWMIService =GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

         Set colProcessList=objWMIService.ExecQuery _
         ("Select * from Win32_Process Where Name='outlook.exe'")

   For Each objProcess in colProcessList
                 objProcess.Terminate()
                 Next 

          else

         wscript.echo "Click Cancel By User"

          end if 

      end if 

    End If

Next


本文转自 bilinyee博客,原文链接:  http://blog.51cto.com/ericfu/1358791      如需转载请自行联系原作者

相关文章
|
8月前
13avalon - 指令ms-skip (skip绑定)
13avalon - 指令ms-skip (skip绑定)
31 0
|
8月前
20avalon - 指令ms-active(active绑定)
20avalon - 指令ms-active(active绑定)
21 0
|
1月前
|
JavaScript 前端开发 算法
【Node.js 版本过高】运行前端时,遇到错误 `Error: error:0308010C:digital envelope routines::unsupported`
【Node.js 版本过高】运行前端时,遇到错误 `Error: error:0308010C:digital envelope routines::unsupported`
188 0
|
Web App开发 JavaScript 前端开发
Selenium使用中报错:We\'re sorry but hr-frontend-v2 doesn\'t work properly without JavaScript enabled
Selenium使用中报错:We\'re sorry but hr-frontend-v2 doesn\'t work properly without JavaScript enabled. Please enable it to continue 这个错误提示表明目标网页要求启用JavaScript才能正常工作,而默认情况下,Selenium WebDriver是启用JavaScript的。如果遇到此错误,请按照以下步骤尝试解决问题
550 0
Selenium使用中报错:We\'re sorry but hr-frontend-v2 doesn\'t work properly without JavaScript enabled
SAP WM初阶Interim Storage Type不好启用Storage Unit Management
SAP WM初阶Interim Storage Type不好启用Storage Unit Management
SAP WM初阶Interim Storage Type不好启用Storage Unit Management
The Soft Link between IM Level Storage Location and WM level Storage Type?(1)
The Soft Link between IM Level Storage Location and WM level Storage Type?(1)
The Soft Link between IM Level Storage Location and WM level Storage Type?(1)
The Soft Link between IM Level Storage Location and WM level Storage Type?(2)
The Soft Link between IM Level Storage Location and WM level Storage Type?(2)
The Soft Link between IM Level Storage Location and WM level Storage Type?(2)
|
Web App开发 JavaScript 前端开发
javascript file cached in server side
Created by Jerry Wang on Aug 03, 2014
javascript file cached in server side
|
测试技术
SAP Spartacus delivery mode continue button enable与否的逻辑
SAP Spartacus delivery mode continue button enable与否的逻辑
107 0
SAP Spartacus delivery mode continue button enable与否的逻辑