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??



Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

maximaalAuthor Commented:
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"
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 :-)

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

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.


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.
maximaalAuthor Commented:
Is there no way to include this registry add without redirecting to the reg file?
Sure, there are lots of ways, all depending upon your definition of "easy way"

Since your data appers larger then four bytes however, I don't think that RegWrite will do the trick for you, so some of your options are:

1) Use WMI (some example code is at

2) Write out to a .reg file and shell it out using regedit.exe /s

3) Shell out the approperite entries to reg.exe (Win2K /XP)

4) Use a 3rd Party RegWriting ActiveX Application, somethink like Registry Pro

5) Write your own ActiveX Control that writes out to the registry. There are lots of samples on making ActiveX controls
and reading/writing the registry in VB itself.

..That's all I can think of a the momemt, but I'm sure there are other ways as well.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
maximaalAuthor Commented:
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?
maximaalAuthor Commented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.