LocalMachineLockdown-wmi.vbs
By The Scripting Guys, Microsoft Corporation
This script turns on or off local machine lockdown for the iexplore.exe process by editing the registry, using the WMI System Registry provider. You must edit the registry path to insert the correct CLSID of the add-on component to be disabled. To identify the CLSID of an add-on component, search the registry for the add-on name that is located in the Manage Add-ons interface.
LocalMachineLockdown-wmi.vbs corresponds to LocalMachineLockdown.vbs, one of the scripts that ships with Application Compatibility Testing and Mitigation Guide for Windows XP Service Pack 2 and which are documented in the Appendix. You can download a Windows Installer (.msi) file that installs the Guide and its associated scripts from:
To use the script, copy the code, paste it into Notepad, and then save the script as LocalMachineLockdown-wmi.vbs. To run the script, open a command prompt window to the directory of the script and type:
cscript localmachinelockdown-wmi.vbs
If the default script host on the computer is Cscript.exe, the initial "cscript" may be omitted.
Script Code
'******************************************************************************
'LocalMachineLockdown-wmi.vbs
'Author: Peter Costantini, the Microsoft Scripting Guys
'Date: 8/25/04
'Revision 1.0
'System requirement: Windows XP Service Pack 2.
'This script edits the registry to turn on or off local machine
'lockdown for the iexplore.exe process.
'It can be run against a local or remote computer.
'Edit intValue as needed. Valid iexplore.exe values are as follows:
'1 = Turns on local machine lockdown.
'0 = Turns off local machine lockdown.
'******************************************************************************
On Error Resume Next
'Global variables
strComputer = "." ' Can be changed to name of remote computer.
'Connect with WMI service and StdRegProv class.
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
If Err = 0 Then
SetValue
Else
WScript.Echo "Unable to connect to WMI StdRegProv on " & strComputer & "."
WScript.Echo " Error Number:" & Err.Number
WScript.Echo " Source:" & Err.Source
WScript.Echo " Description:" & Err.Description
End If
Err.Clear
'******************************************************************************
Sub SetValue
'Local constants and variables
Const HKEY_LOCAL_MACHINE = &H80000002
strKeyPath = "SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl" & _
"\FEATURE_LOCALMACHINE_LOCKDOWN"
strEntryName = "iexplore.exe"
intValue = 0
intReturn = objReg.SetDWORDValue(HKEY_LOCAL_MACHINE, strKeyPath, _
strEntryName, intValue)
If intReturn = 0 Then
WScript.Echo "Changed value of " & strEntryName & " to " & intValue & "."
Else
WScript.Echo "ERROR: Unable to change value of " & strEntryName & "."
End If
End Sub
For online peer support, join The Official Scripting Guys Forum! To provide feedback or report bugs in sample scripts, please start a new discussion on the Discussions tab for this script.
Disclaimer
This sample script is not supported under any Microsoft standard support program or service. The sample script is provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.