- 1 year ago
Find architecture of processor independent of OS in PowerShell
Comment
1 / 1
In PowerShell, you can use the Get-WmiObject
cmdlet to retrieve information about the processor architecture. The following command can be used to obtain the architecture of the processor independent of the operating system:
powershell$arch = (Get-WmiObject Win32_Processor).Architecture
$architecture = switch ($arch) {
0 { "x86" }
1 { "MIPS" }
2 { "Alpha" }
3 { "PowerPC" }
5 { "ARM" }
6 { "Itanium" }
9 { "x64" }
default { "Unknown" }
}
Write-Host "Processor Architecture: $architecture"
The Architecture
property from the Win32_Processor
class is used to determine the processor architecture. The numeric values correspond to different processor architectures, and the switch
statement converts them to human-readable strings.
Please note that the Win32_Processor
class and its properties might be available only on Windows systems. If you need to determine the processor architecture on non-Windows platforms, you would need to use different methods or tools specific to that platform.