Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does anybody know how to grab OS architecture remotely from multiple Windows hosts via PowerShell?

share|improve this question
up vote 4 down vote accepted

get-wmiobject win32_operatingsystem -computer $_ | select-object OSArchitecture

You'll pipeline the list of computer names into this command so that $_ is interpreted as each computer in your list.

Edit: After doing some digging, it appears that this will work on both 2003 and 2008.

get-wmiobject win32_computersystem -computer $_ | select-object systemtype

share|improve this answer
Perfect, it works great. Is there a way to grab OS Architecture for 2003 servers the same way? – Volodymyr M. Oct 15 '12 at 13:48
Hm, I don't see anything in the win32_operatingsystem class properties on 2003 that would work. There might be something in win32_processor but I don't have anything handy to test it with. – MDMarra Oct 15 '12 at 13:52
MDMarra, this is great! Thx for sharing this, that's really hepful. I've start digging into WMIC to get this info for Windows Server 2003 machines. Something like WMIC /NODE:"TESTSERVER1","TESTSERVER2",@"C:\COMPUTERLIST.TXT" cpu get DataWidth /format:list – Volodymyr M. Oct 16 '12 at 6:43
You know you can run that second PowerShell command against a 2003 machine remotely even if it doesn't have PowerShell installed, right? No need to mess with the voodoo black magic known as wmic :) – MDMarra Oct 16 '12 at 10:58

For Windows XP/2003 and up, Win32_Processor has an AddressWidth property which will be 32 or 64, as appropriate.

There's 1 WMI object instance of class Win32_Processor for each CPU known to Windows' Device Manager, so I've typically done this sort of thing in the past. It's VBScript, my PowerShell sucks, but you get the idea...

Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor WHERE AddressWidth='64'")
If colItems.Count = 0 Then
    strArch = "x86"
    strArch = "x64"
End If

update: translated to PowerShell:

If ($(Get-WmiObject -Query "SELECT * FROM Win32_Processor WHERE AddressWidth='64'")) {
    Write-Host "I'm x64"
} Else {
    Write-Host "I'm x86"
share|improve this answer
This is an interesting approach, but the OP asked for PowerShell. – MDMarra Oct 15 '12 at 14:25
Fair enough, I figured that was simple enough to be translated to PowerShell by someone who is sufficiently familiar with it. I'm not. – ThatGraemeGuy Oct 16 '12 at 6:35
OK so...... killer Google-fu + a pocket full of common sense = PowerShell version. :-) – ThatGraemeGuy Oct 16 '12 at 6:49

This works for me

PS > $env:processor_architecture

PowerShell 32-bit or 64-bit

share|improve this answer

Maybe a little less fancy, but for those who don't have remote WMI enabled, a little old-school way would be:

$compList = #<whatever you use to source your list of machines>
ForEach($comp in $compList){
    $testPath64 = '\\' + $comp + '\c$\Program Files (x86)'
    $testPath = '\\' + $comp + '\c$\Program Files'
    $arch = Test-Path $testPath64
    If($arch){Write-Host "$comp is x64"}
        $arch = Test-Path $testPath
        If($arch){Write-Host "$comp is x86"}
        Else{Write-Host "No idea..."}

Or something like that. The crux of the point being, test-path to Program Files (x86) which is only present on 64-bit machines.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.