QUOTE (bennebiest @ Jul 10 2008, 05:03 PM)

To determine the Windows version:
CODE
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each OS In colSettings
Wscript.Echo OS.Caption
WScript.Echo OS.Version
Next
For XP for example, it will give this output:
CODE
Microsoft Windows XP Professional
5.1.2600
You can put the output in a variable and make a Select Case to execute te gpupdate or secedit, dependig on the Windows version.
Happy coding.
I can do this much..
QUOTE
On Error Resume Next
Set objShell = CreateObject("WScript.Shell")
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
For Each objItem in colItems
If InStr(1,objItem.Caption,"Server") Then objShell.Run "notepad.exe", 1, True
Next
objShell.Run "calc.exe", 1, True
This script can detect and run specific file for on specific os, there is a problem, when i run it on Windows 2003 it's opening both notepad and calculator, but on XP it opens calculator only,
so how do i add stop execution after it open notepad on 2003..
Thanks..