reg update from script

OK, I need to programaticaly update the registry for each of our users, that in itself isn’t a problem, our login script already has bit’s of reg tweaking in it, the problem I have is assigning a specific type of value to a key, I’m trying to enter a ‘reg_binary’ but when I look at the number I’m trying to import it’s a series of hex numbers, when I try to import it I get a type mismatch error, I assume it’s not happy with the values I’m giving it.

Please someone help and tell me where I’m going wrong

would it be easier to manually create the key on one box, export it, then script the key import on all the other boxes ?

yeh, thats what I did, but our users can’t use reg tools, so a simple reg import won’t work, I’ve gotten it all working now,


Const HKEY_CURRENT_USER = &H80000001
Dim strKeyPath, ValueName, iValues, oreg
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
Set WshShell = Wscript.CreateObject("Wscript.Shell")

strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Desktop\Components\0"
ValueName = "CurrentState"
iValues = Array(&H02,&H00,&H00,&H40)
Writereg

WshShell.Regwrite "HKCU\Software\Microsoft\Internet Explorer\Desktop\Components\GeneralFlags","00000006","REG_DWORD"
WshShell.Regwrite "HKCU\Software\Microsoft\Internet Explorer\Desktop\Components\0\Source","P:\_ISF HELP FILES\Applications\desktop\Desktop.html","REG_SZ"

wscript.quit



Function Writereg
oReg.CreateKey HKEY_CURRENT_USER,strKeyPath
oReg.SetBinaryValue HKEY_CURRENT_USER,strKeyPath,ValueName,iValues
strKeyPath = Null
BinaryValueName = Null
iValues = Null

End Function

That gives an example of each or the type of keys I had to import. The bug bear, one of the keys conflicted with a group policy setting, so I’ve had to put it all on hold untill I can sort out the group policy side of things. and no it’s not that easy, as we are ‘run’ by a larger body we don’t have access to the adm files that were used to creat the .pol files, so I can’t adjust it :frowning:

Thanks for your reply anyways and I hope this helps someone else in the future