'===============================================================
Const HKEY_LOCAL_MACHINE = &H80000002
'Lines to get the computer Name
Set wshShell = WScript.CreateObject( "WScript.Shell" )
strComputerName = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )
'===============================================================
'To check whether the OS is 32 bit or 64 bit of Windows 7
'===============================================================
'Lines to detect whether the OS is 32 bit or 64 bit of Windows 7
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
'Perform functions for 64-bit OS.
End If
if (instr(strValue,"x86")) then
'Perform functions for 32-bit OS
End If
'===============================================================
2 comments:
is this only Win7 or will work for XP 32bit as well?
This should work with XP as well, though I have not tested it. It is the determination of OS bit and there is no check for OS version.
Post a Comment