PowerTip: Determine if PowerShell is Running x86 or x64


Summary: Boe Prox shows how to determine if Windows PowerShell is running x86 or x64.

Hey, Scripting Guy! Question How can I use Windows PowerShell to determine if I am running x86 or x64?

Hey, Scripting Guy! Answer Use [intptr]::Size as follows:

Switch ([intptr]::Size) {

    4 {"x86"}

    8 {"x64"}      

}

Comments (7)

  1. Sean D. Wheeler says:

    $env:PROCESSOR_ARCHITECTURE

  2. PetSerAl says:

    [Environment]::Is64BitProcess
    [Environment]::Is64BitOperatingSystem

  3. Boe Prox says:

    Great stuff guys! Always multiple ways to accomplish the same thing which is what makes PowerShell great! Thanks for sharing!

  4. roddie digital says:

    @Sean That would tell you whether the computer was x86 or x64 not whether the Powershell being run was x86 or x64

  5. PetSerAl says:

    @roddie PROCESSOR_ARCHITECTURE environment variable for x86 process in x64 operation system will have value "x86".

  6. roddie digital says:

    @PetSerAl Thanks – this is very useful to know!

  7. Richard Maltas says:

    Thanks Sean, exactly what I was looking for!

Skip to main content