Sub DetectOS()
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem In colOperatingSystems
If InStr( objOperatingSystem.Caption,"2003") <> 0 _
or InStr( objOperatingSystem.Caption,"2008") <> 0 Then
WriteLog "Detected Operating System: " & objOperatingSystem.Caption
WriteLog "Script will not continue...."
WScript.Quit(0)
Else
WriteLog "Detected Operating System: " & objOperatingSystem.Caption
WriteLog "Script will continue....."
End if
NextEnd Sub
Thursday, August 12, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment