12-20-2014, 03:20 AM
You got to use Shell Scripting as part of your VB Script and below is the code
In the below code for the following line 1 is to Enable and 0 is to Disable "oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,1"
In the below code for the following line 1 is to Enable and 0 is to Disable "oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,1"
Code:
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\BrowserEmulation"
strValueName = "MSCompatibilityMode"
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,1
If Err = 0 Then
oReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
WScript.Echo "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\BrowserEmulation\MSCompatibilityMode"& "contains " & dwValue
Else
WScript.Echo "Error in creating key" & " and DWORD value = " & Err.Number
End If