Discover System Properties Using WMI

Wednesday Aug 23rd 2000 by ServerWatch Staff
Share:

This script uses WMI to walk through the 'Win32_OperatingSystem' object. This allows you to remotely discover such information as Last Boot Time, NetBIOS Name, Service Pack Level, share names etc...

by John Loomes

This script uses WMI to walk through the 'Win32_OperatingSystem' object. This allows you to remotely discover such information as Last Boot Time, NetBIOS Name, Service Pack Level, share names etc...

This script is only an example that works on a single host, but it could be easily modified to walk through a list of hosts, or the result of a query etc etc......

Set SystemSet = GetObject("winmgmts:{impersonationLevel=impersonate}!//MY_PC").InstancesOf ("Win32_OperatingSystem")

for each System in SystemSet
    WScript.Echo "NETBIOS Name: "& System.CSName
    'WScript.Echo "System.BuildType
    WScript.Echo "Service Pack: " & System.CSDVersion
    WScript.Echo "Last Booted: " & System.LastBootUpTime
    WScript.Echo "Manufacturer: " & System.Manufacturer
    WScript.Echo "O/S Version: " & System.Version
    WScript.Echo System.Name
    iEqual = InStr(1,System.Name, "Workstation",1)
    If (iEqual <> 0) Then
    MsgBox ("Workstation")
    Else
    MsgBox ("Not a Workstation")
    End if
next

Set SystemSet = Nothing

Set ComputerSet = GetObject("winmgmts:{impersonationLevel=impersonate}!//MY_PC").InstancesOf ("Win32_Share")

for each Object in ComputerSet
    WScript.Echo "Share: "& Object.Name
next

Set ComputerSet = Nothing

Set ServiceSet = GetObject("winmgmts:{impersonationLevel=impersonate}!//MY_PC").InstancesOf("Win32_ComputerSystemProduct")

For each Object in ServiceSet
        'Msgbox system.Caption
        'Msgbox system.Description
    '    msgbox system.IdentifyingNumber
        'msgbox "Product: " & Object.Name
        msgbox "Manufacturer: " & Object.Name
       
        'msgbox "Build: " & Object.BuildNumber
next

Set ServiceSet = Nothing

Please note that this is provided 'as is' with no warranties i.e. dont blame me if it all goes wrong!

Share:
Home
Mobile Site | Full Site
Copyright 2017 © QuinStreet Inc. All Rights Reserved