This is what I use -- most from the Technet scripting site and Robbie's
book, I'd guess...

Function OperatingSystemVersion (node)
        Dim objWmiService, colOperatingSystems, objOperatingSystem
        Dim iRetry

        On Error Resume Next

        For iRetry = 0 To 5
                Set objWMIService = Nothing
                Set colOperatingSystems = Nothing

                Err.Clear
                Set objWMIService = GetObject("winmgmts:" _
                    & "{impersonationLevel=impersonate}!\\" & node &
"\root\cimv2")
                If Err.Number = 0 Then
                        Set colOperatingSystems =
objWMIService.ExecQuery _
                            ("Select * from Win32_OperatingSystem")
                        For Each objOperatingSystem in
colOperatingSystems
                                If Len (OperatingSystemVersion) > 0 Then
OperatingSystemVersion = OperatingSystemVersion & vbCrLf
                                OperatingSystemVersion =
OperatingSystemVersion & objOperatingSystem.Caption & " " &
objOperatingSystem.Version

                                Set objWMIService = Nothing
                                Set colOperatingSystems = Nothing

                                Exit Function
                        Next
                Else
                        wscript.Echo "Error binding to root\cimv2 for "
& node & ", " & Err.Description & " (" & Hex(Err.Number) & ")"
                End If
        Next

        Set objWMIService = Nothing
        Set colOperatingSystems = Nothing

        OperatingSystemVersion = "<unknown>"
End Function 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Glenn Corbett
Sent: Thursday, June 17, 2004 4:35 AM
To: [EMAIL PROTECTED]
Subject: [ActiveDir] OT (Sort of): Determining the Edition of Windows
Installed

All,

We are currently undergoing our MS Licensing Upgrade (ugh), and one of
the things I need to know is which version and which edition of windows
server is running on a particular machine.

Getting the version number from the registry is fairly easy, and I've
already configured MS Ops Manager to get this information.  Determining
the edition (server, advanced server etc) is proving a bit more
difficult.  I've used The AD Cookbook (thanks Robbie) and got the basic
list of servers (Windows 2000 v Windows 2003), now just need to work out
what edition of windows is running on them.

Any idea how to quickly retrieve this information ?

TIA

Glenn


List info   : http://www.activedir.org/mail_list.htm
List FAQ    : http://www.activedir.org/list_faq.htm
List archive:
http://www.mail-archive.com/activedir%40mail.activedir.org/


List info   : http://www.activedir.org/mail_list.htm
List FAQ    : http://www.activedir.org/list_faq.htm
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/

Reply via email to