strComputer = "."
strOS_FullName=GetOS
intProc=GetProcessor
Set WshShell=CreateObject("Wscript.Shell")
If instr(1,strOS_FullName,"XP",vbTextCompare) then
strPrefix="xp"
ElseIf instr(1,strOS_FullName,"Vista",vbTextCompare) then
strPrefix="vista"
ElseIf instr(1,strOS_FullName,"Windows 7",vbTextCompare) then
strPrefix="win7"
ElseIf instr(1,strOS_FullName,"2003",vbTextCompare) then
strPrefix="win2003"
Else
strPrefix=""
'msgbox strOS_FullName
End If
If strPrefix="" then
msgbox "Could not determine OS",vbExclamation,"Cab Selector"
wscript.quit
End If
strCab=strPrefix & "-" & intProc & ".cab"
WshShell.run "C:\Windows\system32\printmig -r " & strCab
Function GetOS
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colOSes = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
For Each objOS in colOSes
GetOS=objOS.Caption
Next
End Function
Function GetProcessor
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor")
For Each objItem in colItems
GetProcessor=objItem.AddressWidth
Next
End Function
|