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

VBScript to determine OS

Status
Not open for further replies.

Mewster

Technical User
Jun 29, 2006
2
GB
Hi There, I am absolutely useless with VBScript, I need a some code that will determine the OS of a machine and then run a further piece of code to switch off Windows Firewall if the OS is XP.

I already have the code to switch off the firewall..... Is just the OS determination that I need.

Thanks
 
here is the code:

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

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

For Each objOperatingSystem in colOperatingSystems

msg = objOperatingSystem.Caption & " " & _
objOperatingSystem.Version
msgbox msg
Next
 
Guys thats brilliant, thanks very much!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top