
Adding a value to the registry of a remote PC using REGOBJ.DLL
Please help of you can:
I purchased the book "Windows Scripting Host 2.0 Developers Guide" and I
was trying to write a program and I have run into a problem trying to add
a value to the registry on a remote PC. I have a need to invoke a program
one time on about 300 PC's and thought that if I could add this to the
HKLM\Software\microsoft\windows\currentversion\runonce I could handle this
remotely though a single program. In the book the author mentioned that you
could do this sort of thing by installing the RegObj.dll that was available
from Microsoft and also included on the CD that accompanied the the Book.
After installing and registering the DLL, I wrote the following program
based on the information in the book and the RegObj.doc file found on the
CD.
DIM Objreg,ObjKey,ObjRemote
Set Objreg = Wscript.CreateObject("RegObj.Registry")
Set ObjRemote = ObjReg.RemoteRegistry("\\TESTPC")
Set ObjKey =
ObjRemote.RegKeyFromString("\HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
\CurrentVersion\RunOnce")
ObjKey.Values.Add "DMITEST", "D:\DMI\DMICOPY.VBS", "REG_SZ"
The problem that I am having seems to be related to the last line in the
program. When run, my program produces an error message that reads:
Test1.vbs(5, 1) RegValues: Type Mismatch.
The RegObj.DOC shows that the last line of code should contain a reference
to RegValueType but doesn't give an example of how to set this up. The
code sample in the doc is:
ObjKey.Values.Add "Name1", "value", RegValueType.rvString
Any help you could offer would be greatly appreciated.
Thanks you!