
RegObj.dll - Newbie Example
No offense, but you have a pretty weird combination of vbscript/vb/jscript ;-)...
Here's just a CScript hosted vbscript example for remote registry access with RegObj. You must be
logged on with a domain account that is also in the Administrators group on the remote NT server
machine.
Dim StdIn, StdOut
Dim objRegistry, objRemoteRegistry
Dim objRegRootKey, objSubKey
Const HKEY_CLASSES_ROOT = &H80000000
'===
' uses stdin/stdout streams to guarantee execution under WScript will fail
' (unless you like clicking OK on about a zillion message boxes ;-)...
'===
Set StdIn = WScript.StdIn
Set StdOut = WScript.StdOut
Set objRegistry = CreateObject("RegObj.Registry")
'===
' fully qualified domain names are faster, but NETBIOS name works too...
'===
Set objRemoteRegistry = _
objRegistry.RemoteRegistry("servername.companyname.com")
Set objRegRootKey = objRemoteRegistry.RegKeyFromHKey(HKEY_CLASSES_ROOT)
For Each objSubKey In objRegRootKey.SubKeys
StdOut.WriteLine objSubKey.Name
Next
StdOut.WriteLine ""
StdOut.WriteLine "Press ENTER to continue..."
StdIn.ReadLine
--
Michael Harris
Microsoft.MVP.Scripting
--
Please do not email questions - post them to the newsgroup instead.
--
Quote:
> I'm new to programing. I can't seem to get the script below coverted to VBS.
> Can anyone help? I really don't need to access a remote registry. The local
> registry is what I want to work with.
> Thanks for all the help. You guys have been great!
> Lando
> ***********************************************
> Dim WSHShell
> Set WSHShell = WScript.CreateObject("WScript.Shell")
> Dim objRemoteRegistry
> 'See if we can obtain the Registry of machine Lab1:
> Set objRemoteRegistry = RemoteRegistry("IFORKASH-2K")
> 'Print out all the subkeys of the HKEY_CLASSES_ROOT on the Lab1 machine
> Dim objSubKey As RegKey
> Dim objRegRootKey As regKey
> var ProxyOnOff =
> WshShell.RegRead("HKEY_USERS\\ThisUser\\Software\\Microsoft\\Windows\\Curren
> tVersion\\Internet Settings\\ProxyEnable")
> var ProxyType = typeof(ProxyOnOff)
> Set objRegRootKey = objRemoteRegistry.RegKeyFromHKey(HKEY_CLASSES_ROOT)
> For Each objSubKey In objRegRootKey.SubKeys
> Debug.Print objSubKey.Name
> Next objSubKey
> ************************************************************
> > The good examples are on Clarence's site (http://cwashington.netreach.net)
> which unfortunately is
> > temporarily offline.
> > Check the regobj.doc file that came with the component... The examples
> are for VB but translate
> > easily to vbscript...
> > --
> > Michael Harris
> > Microsoft.MVP.Scripting
> > --
> > Please do not email questions - post them to the newsgroup instead.
> > --
> > > Hi,
> > > I new to scripting/programming. Can someone post an example VBS script
> that
> > > uses this control? I just need some basics and can work from there. I am
> > > looking to delete registry keys and read registry keys? Also, is there a
> way
> > > to silently register this control? Thanks in advance for the help.
> > > Lando