Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script to get os architecture and install program

Status
Not open for further replies.

Lordmathos

IS-IT--Management
Oct 21, 2005
243
GB
Hi all, im new to vbs and after quite a long time of searching am struggling to find a script to do what i need.

I am trying to write a script that will get an os architecture (x86/x64) and if the os is x86 then run the x86 msi and if it is x64 then run the x64 msi.

Would appreciate any help.

Thanks

In theory, there is no difference between theory and practice. But, in practice, there is.
 
use WMI

Code:
set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
set colProcessors = objWMI.ExecQuery("Select * from Win32_Processor")
	
for each objProcessor in colProcessors
	strSystemArchitecture = objProcessor.AddressWidth
next

if (strSystemArchitecture = "32") then
	'do 32-bit
elseif (strSystemArchitecture ="64") then
	'do 64-bit
end if

-Geates

 
Thanks for that.

unfortunately it is to run on a Windows Server 2000 domain adn I dont think WMI works on that. :S

In theory, there is no difference between theory and practice. But, in practice, there is.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top