[实战一]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      如需转载请自行联系原作者

相关文章
微信分享报错 wxlog:Error:fail to load Keychain status:-25300 解决办法
微信分享报错 wxlog:Error:fail to load Keychain status:-25300 解决办法
2379 0
|
6月前
|
JavaScript 前端开发 算法
【Node.js 版本过高】运行前端时,遇到错误 `Error: error:0308010C:digital envelope routines::unsupported`
【Node.js 版本过高】运行前端时,遇到错误 `Error: error:0308010C:digital envelope routines::unsupported`
2583 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的。如果遇到此错误,请按照以下步骤尝试解决问题
742 0
Selenium使用中报错:We\'re sorry but hr-frontend-v2 doesn\'t work properly without JavaScript enabled
|
测试技术
loadrunner 运行脚本-Run-time Settings->General->Additional attributes设置
loadrunner 运行脚本-Run-time Settings->General->Additional attributes设置
100 0
|
Go 数据库
IDEA连接数据库错误:Server returns invalid timezone. Go to ‘Advanced‘ tab and set ‘serverTimezon‘ 错误
IDEA连接数据库错误:Server returns invalid timezone. Go to ‘Advanced‘ tab and set ‘serverTimezon‘ 错误
148 0
IDEA连接数据库错误:Server returns invalid timezone. Go to ‘Advanced‘ tab and set ‘serverTimezon‘ 错误
SAP QM 执行事务代码QA11 报错- Selected set code does not exist, or data entered is incomplete-
SAP QM 执行事务代码QA11 报错- Selected set code does not exist, or data entered is incomplete-
SAP QM 执行事务代码QA11 报错- Selected set code does not exist, or data entered is incomplete-
|
Linux 数据安全/隐私保护
下一篇
无影云桌面