Hi
anyone know how to find if OS is x86 or x64 then Windows 7 or XP and run msi
each piece of code does one part how do I combine the two
MCITP:EA/SA, MCSE, MCSA, MCDBA, MCTS, MCP+I, MCP
anyone know how to find if OS is x86 or x64 then Windows 7 or XP and run msi
each piece of code does one part how do I combine the two
Code:
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputerName & "\root\default:StdRegProv")
strKeyPath = "HARDWARE\DESCRIPTION\System\CentralProcessor\0"
strValueName = "Identifier"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
'===============================================================
'Checking Condition whether the build is 64bit or 32 bit
If (instr(strValue,"64")) then
WshShell.Run "Windows 7 64-bit.MSI" /qn
End If
elseif (instr(strValue,"x86")) then
WshShell.Run "Windows 7 32-bit.MSI" /qn
End If
Code:
Function FindOSType(strComputer)
'Defining Variables
Dim objWMI, objItem, colItems
Dim OSVersion, OSName, ProductType
'Get the WMI object and query results
Set objWMI = GetObject("winmgmts://" & strComputer & "/root/cimv2")
Set colItems = objWMI.ExecQuery("Select * from Win32_OperatingSystem",,48)
'Get the OS version number (first two) and OS product type (server or desktop)
For Each objItem in colItems
OSVersion = Left(objItem.Version,3)
ProductType = objItem.ProductType
Next
'Time to convert numbers into names
Select Case OSVersion
Case "6.1"
OSName = "Windows 7"
Case "6.0"
OSName = "Windows Vista"
Case "5.2"
OSName = "Windows 2003"
Case "5.1"
OSName = "Windows XP"
Case "5.0"
OSName = "Windows 2000"
Case "4.0"
OSName = "Windows NT 4.0"
Case Else
OSName = "Windows 9x"
End Select
'Return the OS name
FindOSType = OSName
End Function
MCITP:EA/SA, MCSE, MCSA, MCDBA, MCTS, MCP+I, MCP