Theo
Mon Mar 01 13:53:24 CST 2004
Thank you!
What if I simply want to verify if a key exists, without retrieving its
value(s)?
Which is , referring to your example. what if i just want to check if
SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB828028 exists?
Thank you!
theo
"Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
news:40438EF3.9E0A573B@hydro.com...
> Theo Welles wrote:
>
> > How can I check for the presence of a registry entry on remote computers
in
> > my domain?
> >
> > Any code example?
>
> Hi
>
> Here is a WMI example:
>
> Const HKLM = &H80000002
>
> sComputer = "name or IP address" ' use "." for local computer
>
> Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
> & sComputer & "\root\default:StdRegProv")
>
> sKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB828028"
> sValueName = "Installed"
> iRC = oReg.GetDWORDValue(HKLM, sKeyPath, sValueName, sValue)
>
> If iRC = 0 Then
> If sValue = 1 Then
> WScript.Echo "MS04-007 (KB828028) is installed"
> Else
> WScript.Echo "MS04-007 (KB828028) is not installed"
> End If
> Else
> WScript.Echo "MS04-007 (KB828028) is not installed"
> End If
>
>
>
> You should check if the remote computer is online before connecting, and
> also error handle the WMI connection, take a look here for an example:
>
>
http://groups.google.com/groups?selm=3FFF09CA.D7D4888A%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
>
>