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.
-
@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.
-
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.
-
If you want a slightly different result :
(Get-CimInstance -ClassName win32_operatingsystem).OSArchitecture
Results in :
64-bit
or
32-bit
-
@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.