Tuesday, October 12, 2010

Disabling Cached mode in Outlook VBS


Cached Exchange Mode is controlled by the following key;[HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\\13dbb0c8aa05101a9bb000aa002fc45a]
00036601     (REG_BINARY)
enabled value;  84 01 00 00
enabled with Public Folders/Favorites: 84 05 00 00
disabled value; 04 00 00 00
This vbscript below (vbs) programmatically enumerates all the profiles and edits the key with new binary data:

On error resume next
CONST HKEY_LOCAL_MACHINE = &H80000002 
Const HKEY_CURRENT_USER = &H80000001
CONST strComputer = "."
Set objRegistry=GetObject("winmgmts:\\" & _ 
    strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles"
objRegistry.EnumKey HKEY_CURRENT_USER, strKeyPath, arrSubkeys
For Each objSubkey In arrSubkeys
    strValueName = "outlook"
    strSubPath = strKeyPath & "\" & objSubkey
    objRegistry.GetExpandedStringValue HKEY_LOCAL_MACHINE,strSubPath,strValueName,strValue
    Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
   strComputer & "\root\default:StdRegProv")
    strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\" & _
   objSubKey & "\13dbb0c8aa05101a9bb000aa002fc45a"
    strEntryName = "00036601"
    dwValue = Array(4,0,0,0)
    objReg.SetBinaryValue HKEY_CURRENT_USER, strKeyPath, strEntryName, dwValue
Next

No comments:

Post a Comment