Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How would you determine the OS a device is running.

Status
Not open for further replies.

Stephon98caffe

Programmer
Feb 18, 2005
25
US
I have a list of computers and need to determine what type of OS they have on them.
CN=COCL28I-1 ,OU=Computers,OU=ITSS,OU=VACO,DC=dva,DC=va,DC=gov

I have not had much practice using

getObject("wingmts://

what would I need to print what type of OS cocl28-I has?
 
Have a look at the Win32_OperatingSystem WMI class.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
This worked best for me. I trimmed the echoed result to only show the first 3 charactors.
4.0 = NT
5.0 = Win2000
5.1 = XP
5.2 = Server 2003


'begin script
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")

For Each objOperatingSystem in colOperatingSystems
OS = LEFT(objOperatingSystem.Version,3)
Wscript.Echo OS
Next
'End script
 
Take a look at this thread: thread779-1190860, I provided a script for this.

I hope you find this post helpful.

Regards,

Mark
 
i am not sure you need to worry about WMI or binding to each computer literally, your moniker string looks like AD? therefore just bind to the OU loop through the Computer objects and pull out IADsComputer::OperatingSystem....by the looks of things AD collects this information centrally for you..
 
If you right click the properties of a computer thats in the active directory it will tell you the OS the computer is using.
 
hence my post about querying AD rather than the actual machine
 
If going the AD route you just need to watch out. I've had problems where it misreports an OS, particularly SP level. You also need to identify which machines are dead accounts still listed in AD, which is a GOOD thing about doing it this way so you clean up your AD. You would need a list of PCs going the other way anyway so this is a good exercise no matter what.

I hope you find this post helpful.

Regards,

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top