Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Registry adds in vbs??

Posted on 2006-03-20
12
Medium Priority
?
508 Views
Last Modified: 2008-01-09
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
0
Comment
Question by:maximaal
  • 5
  • 5
10 Comments
 
LVL 1

Author Comment

by:maximaal
ID: 16236479
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"
0
 
LVL 3

Expert Comment

by:bdetchevery
ID: 16237285
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 :-)

0
 
LVL 1

Author Comment

by:maximaal
ID: 16238982
it really looks fancy, but i just want to add the registry add to my current script.

tnx
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:bdetchevery
ID: 16239610
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.
0
 
LVL 1

Author Comment

by:maximaal
ID: 16245200
Is there no way to include this registry add without redirecting to the reg file?
0
 
LVL 3

Accepted Solution

by:
bdetchevery earned 1000 total points
ID: 16246329
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 http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/registry/)

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 http://www.downloadjunction.com/product/software/21609/

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.
0
 
LVL 1

Author Comment

by:maximaal
ID: 16246555
ok, tnx.
I see them as a 2nd choice.
I cant understand why there is no way to include hexadecimal into vbs
0
 
LVL 3

Expert Comment

by:bdetchevery
ID: 16247928
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?
0
 
LVL 1

Author Comment

by:maximaal
ID: 16280760
Is there no trick to fix it?
0
 
LVL 3

Expert Comment

by:bdetchevery
ID: 16283106
Not that I know of, perhaps there is (or will be) a new release of VBScript without the limitation.

Wish I could say more
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
No other job is as rewarding and demanding as building an iPhone app is. It is not really in the hands of the developer for the success of an iPhone app. Many factors operate jointly for every iOS application's success in the market.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Loops Section Overview

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question