IT Management Suite Documentation

 View Only

VBScript to Determine 32-bit or 64-bit Machine 

Apr 30, 2012 12:23 PM

Often we come across a situation where we need to see the Operating system bit information and then install application or do any customization. Also many times we have different MSI for different OS type and we are in a confusion how to deploy them through 1 package in a deployment tool. Or in many cases how to explain it to helpdesk to install which MSI for which machine.

It is easier to give them a script which will automatically determine the OS type and will install the corresponding application.

Here is a script which I use for this purpose:


'===============================================================

'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

elseif (instr(strValue,"x86")) then

'Perform functions for 32-bit OS
'End If
'===============================================================

 

Hope this script helps you solve your issues.

Statistics
0 Favorited
0 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Comments

Jun 15, 2012 10:46 AM

This really helped me in pushing a task to a bunch of Win 7 machines! Thanks man!

Related Entries and Links

No Related Resource entered.