Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

determine 32 or 64bit OS?

$
0
0

Hello,

Need to determine via script if running on a 32 or 64bit version of windows. It needs to work on server 2003, 2008, and 2008R2, so Win32_Operatingsystem's OSArchitecture property will not work for all (not available on server 2003).

I've seen others say to use the following (copy/paste from MSDN doc)
http://msdn.microsoft.com/en-us/library/aa394373%28v=VS.85%29.aspx : 

--------------------------
The Win32_Processor class has these properties.

AddressWidth
Data type: uint16
Access type: Read-only

On a 32-bit operating system, the value is 32 and on a 64-bit operating system it is 64. This property is inherited from CIM_Processor.

------------

so considering that is a property of the processor, I'm wondering if this can be relied on to determine the OS architecture? Can anyone confirm this is the recommended and reliable way to go? Otherwise, I will write a function that uses OSArchitecture for 2008 and 2008R2 and use the Win32_OperatingSystem 'Name' property for server 2003. Between those two things I know I can reliable return the correct information, but if there is one simple place to check, of course I would rather just do that.

anyone?


Viewing all articles
Browse latest Browse all 21975

Trending Articles