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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to detect Operating System?

Status
Not open for further replies.

Guern

Programmer
Jun 22, 2001
91
GB
Hi,

Is there a call to return the OS type i.e. Win95, 98, NT, 2000 etc?

Thanks.
 
Hi,

Thanks for that. Yes, I can do .net, but this will be wsh on Win95/98 etc. They will not have .net installed.

At the moment, the idea I have is to look for certain files, but that's not as reliable as I'd like.

 
using WMI

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
Wscript.Echo objOperatingSystem.Caption & " " & objOperatingSystem.Version
Next

possibly faster, you can query ExpandEnvirnomentStrings and take a look at COMSPEC, being cmd.exe for w2k, nt etc and command for w9x

hope it helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top