Open Notepad and past the code below
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
For each elem in colItems
If instr(elem.CSDVersion, "2") Then
msgbox "Found Service Pack2"
' Place your code here
Else
If instr(elem.CSDVersion, "3") Then
msgbox "Found Service Pack3"
' Place your code here
End If
End If
Next
save as SP3.vbs
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
For each elem in colItems
If instr(elem.CSDVersion, "2") Then
msgbox "Found Service Pack2"
' Place your code here
Else
If instr(elem.CSDVersion, "3") Then
msgbox "Found Service Pack3"
' Place your code here
End If
End If
Next
save as SP3.vbs