ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    PowerShell Determine if Running 32 bit or 64 bit OS

    IT Discussion
    powershell windows
    3
    5
    956
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • scottalanmillerS
      scottalanmiller
      last edited by

      This is a cat with likely many ways to skin it, but this is the best way that I can find to figure out if you are running a 32bit OS or a 64bit OS in Windows.

      [System.Environment]::Is64BitOperatingSystem
      

      True for 64bit, False for 32bit.

      DustinB3403D 1 Reply Last reply Reply Quote 0
      • DustinB3403D
        DustinB3403 @scottalanmiller
        last edited by

        @scottalanmiller said in PowerShell Determine if Running 32 bit or 64 bit OS:

        This is a cat with likely many ways to skin it, but this is the best way that I can find to figure out if you are running a 32bit OS or a 64bit OS in Windows.

        [System.Environment]::Is64BitOperatingSystem
        

        True for 64bit, False for 32bit.

        Leave it to MS to use a True/False statement when you're looking for a more descriptive answer.

        1 Reply Last reply Reply Quote 1
        • scottalanmillerS
          scottalanmiller
          last edited by

          Of all the PS problems, that one I think is pretty minor. True/False is fine given the clear nature of the question. But the bigger issue is, why is this a different format from all the rest of PS? Easy, yes. But very long and wordy. That's a lot of characters to get one really basic yes/no answered.

          1 Reply Last reply Reply Quote 1
          • M
            manxam
            last edited by

            If you want a slightly different result :

            (Get-CimInstance -ClassName win32_operatingsystem).OSArchitecture
            

            Results in :

            64-bit
            

            or

            32-bit
            
            scottalanmillerS 1 Reply Last reply Reply Quote 1
            • scottalanmillerS
              scottalanmiller @manxam
              last edited by

              @manxam so much longer, though. I had checked that out, but find the other to be better.

              However if you are writing a script to fill out a form, I can see this being handier.

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post