Recent Tweets by Zeaun

Monthly Archives: October 2010

Powershell Tip: Determine whether your system is 32-bit or 64-bit

As an administrator you already know if your target system is 32bit or 64bit, but that is not immediately true for your Powershell scripts.

Why you need this:
If you need to run any opration (such as a software installation) differently depending on whether a system is 32-bit or 64-bit.

Why I came up with this:
I used to do this by running an if query against the $env:programfiles(x86) but I quickly realized that this was not the most efficient way of determining this. Instead I have derived the following:

$test = get-wmiobject win32_computersystem
if ($test.systemtype -like "x64*"){command_or_executable_to_be_run}

The above… Continue reading