Adding a value to the registry of a remote PC using REGOBJ.DLL 
Author Message
 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!



Tue, 28 Oct 2003 12:02:29 GMT  
 Adding a value to the registry of a remote PC using REGOBJ.DLL
Try...

shell.Run("regedit /s \\servername\netlogon\regfile.reg")

where regfile's contents look like...

"REGEDIT4
[HKEY_USERS\.DEFAULT\Software\Microsoft\Exchange]" for instance.

Nathan


Quote:
> 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!



Tue, 28 Oct 2003 22:08:13 GMT  
 Adding a value to the registry of a remote PC using REGOBJ.DLL
Const rvNone = 0
Const rvString = 1
Const rvExpandString = 2
Const rvBinary = 3
Const rvLong = 4
Const rvMultiString = 7

RegObj.dll was originally written for use from VB - use the VB Object Browser to look the named
constants...

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup instead.
--

Quote:

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



Wed, 29 Oct 2003 05:20:51 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Reading binary registry values using regobj.dll

2. Creating registry values (using Regobj.dll)

3. Query Remote Registry RegObj.dll

4. Newbie needs help in reading installed programs from the registry using RegObj.dll

5. Newbie needs help in reading installed programs from the registry using RegObj.dll

6. Newbie needs help in reading installed programs from the registry using RegObj.dll

7. Registry access using regobj.dll on NT

8. Newbie needs help in reading installed programs from the registry using RegObj.dll

9. Registry access using regobj.dll on NT

10. RP: Need help - reading/writing binary values using regobj.dll

11. Need help - reading/writing binary values using regobj.dll

12. RP: Need help - reading/writing binary values using regobj.dll

 

 
Powered by phpBB® Forum Software