Link to home
Start Free TrialLog in
Avatar of maximaal
maximaalFlag for Netherlands

asked on

Registry adds in vbs??

I have a .reg file, working fine. But now i want to add the registry add to the login script (vbs)
Most of it is no problem. But the Hexadecimal is drivin me insane.
How can i add this to my login script, on a easy way??

(
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState]
"Settings"=hex:0c,00,02,00,1b,01,e7,77,60,00,00,00
"FullPath"=dword:00000001

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer]
"NoSaveSettings"=dword:00000000
)

tnx
Avatar of maximaal
maximaal
Flag of Netherlands image

ASKER

this is one of the things i tried:

WSHShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState\Settings","0c,00,02,00,1b,01,e7,77,60,00,00,00","REG_BINARY"
Avatar of bdetchevery
bdetchevery

I think WSH RegWrite will write at most one DWORD (= FOUR bytes of binary data) to a REG_BINARY value. Larger values are not supported with this method.

I usually just create the .REG file and shell out regedit /s myfile.reg to add the registry edits.

if you want to get real fancy you can try WMI (with XP and Win2K)

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & sComputer & "\root\default:StdRegProv")
sKeyPath = "Software\MicrosoftWindows\CurrentVersion\Explorer\CabinetState\"
sValueName = "Settings"
oReg.SetBinaryValue HKCU, sKeyPath, sValueName, aValueData

But I'm not the best with WMI stuff :-)

it really looks fancy, but i just want to add the registry add to my current script.

tnx
Understood,

So as I've said, I would just do something like:

Set WSHShell.Run ("%windir%\regedit.exe /s myfile.reg")

If you want the registry edit itself to be part of the script, just write it out to the temp directory using the FileSystem Object first and then run the WSHSell.Run ...

Hope this helps,

Brad D.
Is there no way to include this registry add without redirecting to the reg file?
ASKER CERTIFIED SOLUTION
Avatar of bdetchevery
bdetchevery

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ok, tnx.
I see them as a 2nd choice.
I cant understand why there is no way to include hexadecimal into vbs
Neither can I,  for some reason they imposed a 4 byte limit. I guess it needed to be released on a certain date even if all the features weren't fully implemented?
Is there no trick to fix it?
Not that I know of, perhaps there is (or will be) a new release of VBScript without the limitation.

Wish I could say more