Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modifying DWORD value in registry with script - Help

Status
Not open for further replies.
Aug 14, 2003
94
US
Hi Everyone,

I'm trying to write a VBS script to change the value of [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main] "allowWindowReuse" from 1 to 0.

I tried the following script but it doesn't work.

HELP!

HKEY_CURRENT_USER = &H80000001

strComputer = "."

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

strKeyPath = "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main"
strValueName = "AllowWindowReuse"
dwValue = 0
oReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue
 
kelleygirl01,

It's working is like this.
[tt]
strKeyPath = "Software\Microsoft\Internet Explorer\Main"
[/tt]
HKCU part is taken care of by the constant indicating the branch of registry.

regards - tsuji
 
Is there really a need to use WMI for this? Something as simple as the RegWrite method would do the trick nicely.

Set oShell = CreateObject("WScript.Shell")

strKeyPath = "HKCU\SOFTWARE\Microsoft\Internet Explorer\Main\"

oShell.RegWrite strKeyPath & "AllowWindowReuse", "0", "REG_DWORD"

Cheers,
JEngles
 
Both work, thanks! I really like the regwrite method.

Where can i learn more about administrative scripting?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top