Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Script to detect if hotfix is found on registry

0 views
Skip to first unread message

tl

unread,
Oct 22, 2003, 4:29:41 AM10/22/03
to
I need a script to detect if a certain hotfix is found on
the registry on a remote server. Does anyone have a script
to share? Thanks.....

Torgeir Bakken (MVP)

unread,
Oct 22, 2003, 10:28:22 AM10/22/03
to
tl wrote:

Hi

VBScript/WMI example to see if KB828035 is installed:


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\KB828035"
sValueName = "Installed"
iRC = oReg.GetDWORDValue(HKLM, sKeyPath, sValueName, sValue)

If iRC = 0 Then
If sValue = 1 Then
WScript.Echo "KB828035 is installed"
End If
End If


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


Peter Thomas

unread,
Oct 22, 2003, 8:24:08 PM10/22/03
to
Early morning brain deadness on my behalf.... what is the syntax to loop
through the hotfix keys and display what hotfixes are installed...
Thanks in advance..
---
"Torgeir Bakken (MVP)" <Torgeir.B...@hydro.com> wrote in message
news:3F969406...@hydro.com...

tl

unread,
Oct 22, 2003, 11:34:31 PM10/22/03
to
Hi Torgeir,

It works,thanks!

What if I need to check the same patch on several servers
(probably read the list of servers through a notepad) and
then output the results to excel spreadsheet?

Tl

Torgeir Bakken (MVP)

unread,
Oct 23, 2003, 3:49:00 AM10/23/03
to
Peter Thomas wrote:

> Early morning brain deadness on my behalf.... what is the syntax to loop
> through the hotfix keys and display what hotfixes are installed...
> Thanks in advance..

Hi

Enumerate Subkeys
http://www.microsoft.com/technet/scriptcenter/registry/scrreg09.asp

Torgeir Bakken (MVP)

unread,
Oct 23, 2003, 4:05:40 AM10/23/03
to
tl wrote:

> What if I need to check the same patch on several servers
> (probably read the list of servers through a notepad) and
> then output the results to excel spreadsheet?

Hi

Yes, you can read the server names from a text file (you could also ping them
first to see if they are online before trying to connect with WMI).

The result I would have saved to a CSV file (Excel reads CSV files very nicely
to create a spreadsheet). Create a file with extension .csv and write a new
line for each server with the status, e.g. like this:

Server1,Patched
Server2,Could not connect
Server3,Not patched


To read computer names from a text file, here is a simple example:
http://groups.google.com/groups?selm=3F4BB6CE.289BB749%40hydro.com

Here is a example on writing to a log file (e.g. a CSV file), as well as
pinging computers to see if they are online:
http://dev.remotenetworktechnology.com/wsh/tb/remoteinstallwmi.htm

--

0 new messages