All,

I am looping thorugh the computer objects in a Domain. Within the loop I
need to bind to each maching and read the registry. I would like to discern
the status of the remote machine before attempting to bind to it. Does
anyone have any suggestions?

I am assuming that the IADS computerstatus can't be used based on previous
posts. If this works can someone point me toward an example?

Otherwise any suggestions would help.

Thanks in advance
PO

Re: status of remote machine. by Shahir

Shahir
Tue Oct 21 09:40:46 CDT 2003

Here is what I have done in the past using WMI within a loop:

'Outside of the loop of course
Const HKEY_LOCAL_MACHINE = &H80000002

strComputerName = "computername"
strRemoteUserName = "domain\username"
strRemotePassword = "password"

'WMI - Setup the objects required for WMI
Set objWmiSvc = objWmiLocator.ConnectServer
(strComputerName,"root\default", strRemoteUserName, strRemotePassword)
ObjWmiSvc.Security_.impersonationlevel = 3
Set objRegistry = objWmiSvc.Get("StdRegProv")

'WMI - Setup the location of the key and the name of the key
strADBaseKey = "SOFTWARE\Blah\Blah\"
strADKeyValue = "CYA"

'WMI - Query the remote registry
readADlRC = objRegistry.GetStringValue(HKEY_LOCAL_MACHINE, strADBaseKey,
strADKeyValue, strADRetKeyValue)

'WMI - The following will run only if the Key exists and its value is "1"
If ((readADlRC = 0) AND (strADRetKeyValue = 1)) Then
Do Something
Else
Wscript.Echo "ERROR!!!"
End If

Note that the strADRetKeyValue will be the value of CYA at
"HKEY_LOCAL_MACHINE\SOFTWARE\Blah\Blah\".

You can also set registry values using the

objRegistry.SetStringValue(HKEY_LOCAL_MACHINE, strADBaseKey,
strADKeyValue, strADRetKeyValue)

Refer to the WMI documentation for more information.

Shahir

"Phil Offield" <philo@libety.edu> wrote in message
news:Omoe810lDHA.2444@TK2MSFTNGP09.phx.gbl...
> All,
>
> I am looping thorugh the computer objects in a Domain. Within the loop I
> need to bind to each maching and read the registry. I would like to
discern
> the status of the remote machine before attempting to bind to it. Does
> anyone have any suggestions?
>
> I am assuming that the IADS computerstatus can't be used based on previous
> posts. If this works can someone point me toward an example?
>
> Otherwise any suggestions would help.
>
> Thanks in advance
> PO
>
>



Re: status of remote machine. by Torgeir

Torgeir
Tue Oct 21 17:21:17 CDT 2003

Phil Offield wrote:

> All,
>
> I am looping thorugh the computer objects in a Domain. Within the loop I
> need to bind to each maching and read the registry. I would like to discern
> the status of the remote machine before attempting to bind to it. Does
> anyone have any suggestions?
>
> I am assuming that the IADS computerstatus can't be used based on previous
> posts. If this works can someone point me toward an example?
>
> Otherwise any suggestions would help.

Hi

To see if the computer is online, you could ping it first...

The VBScript function IsConnectible in the link below will work on all OS
versions (it uses ping.exe to ping the host to see if it is online):

http://groups.google.com/groups?selm=3EB2AA54.EBB5ECBC%40hydro.com


--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter



Re: status of remote machine. by Phil

Phil
Fri Oct 24 13:38:50 CDT 2003

LOL

That'll work!

:)

"Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
news:3F95B15D.77AC8BCC@hydro.com...
> Phil Offield wrote:
>
> > All,
> >
> > I am looping thorugh the computer objects in a Domain. Within the loop I
> > need to bind to each maching and read the registry. I would like to
discern
> > the status of the remote machine before attempting to bind to it. Does
> > anyone have any suggestions?
> >
> > I am assuming that the IADS computerstatus can't be used based on
previous
> > posts. If this works can someone point me toward an example?
> >
> > Otherwise any suggestions would help.
>
> Hi
>
> To see if the computer is online, you could ping it first...
>
> The VBScript function IsConnectible in the link below will work on all OS
> versions (it uses ping.exe to ping the host to see if it is online):
>
> http://groups.google.com/groups?selm=3EB2AA54.EBB5ECBC%40hydro.com
>
>
> --
> torgeir
> Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of the 1328 page
> Scripting Guide: http://www.microsoft.com/technet/scriptcenter
>
>