≡ Menu

Find CPU architecture remotely on Windows Using PowerShell

I have written a post on the same topic sometime back but that was relying on environment variables to find the CPU architecture. While that is reliable, it can not be extended easily to query remote computers CPU architecture. The script I am going to discuss in this article relies on WMI classes to get the CPU architecture.

Per MSDN, the Architecture property of Win32_Processor class represent the type of architecture of  CPU. So the below script queries the Architecture value to get the CPU architecture. It will not only cover x86/x64-bit processor architecture but also works for other architectures like ARM, MIPS, etc.


 [string[]]$ComputerName =$env:ComputerName            
$CPUHash = @{0="x86";1="MIPS";2="Alpha";3="PowerPC";5="ARM";6="Itanium-based systems";9="x64"}            
foreach($Computer in $ComputerName) {            
Write-Verbose "Working on $Computer"            
 try {            
 $OutputObj = New-Object -TypeName PSobject            
 $OutputObj | Add-Member -MemberType NoteProperty -Name ComputerName -Value $Computer.toUpper()            
 $OutputObj | Add-Member -MemberType NoteProperty -Name Architecture -Value "Unknown"            
 $OutputObj | Add-Member -MemberType NoteProperty -Name Status -Value $null            
 if(!(Test-Connection -ComputerName $Computer -Count 1 -quiet)) {            
  throw "HostOffline"            
    $CPUObj = Get-WMIObject -Class Win32_Processor -ComputerName $Computer -EA Stop            
 $CPUArchitecture = $CPUHash[[int]$CPUObj.Architecture]            
 if($CPUArchitecture) {            
  $OutputObj.Architecture = $CPUArchitecture            
  $OutputObj.Status = "Success"            
 } else {            
  $OutputObj.Architecture = ("Unknown`({0}`)" -f $CPUObj.Architecture)            
  $OutputObj.Status = "Success"            
 } catch {            
 $OutputObj.Status = "Failed"            
 Write-Verbose "More details on Failure: $_"            



This script is available on technet scripting gallery as well.