PowerShell: Check if O/S is 32 or 64 bit

I was on a client site doing a PowerShell script for an application that could potentially be deployed to either a Windows 7 32-bit or a Windows 7 64-bit, and I was looking for a very simple method of checking to see whether the Operating System was 32-bit or 64-bit, as that would dictate the package to install onto the client’s workstation.  I read an article about KISS (Keep It Simple Stupid) whilst looking for the answer, and I found that the below PowerShell code was the simplest way to check if the O/S is a 32-bit O/S:

As you can see very simple!  If the “Program Files (x86)” folder exists, we are assuming that the O/S is 64-bit and we return $true.  At that point you can then do an if statement:

Test deployed on a 100 workstations, which was a mix of 32 and 64-bit workstations and worked like a charm with no issues thus far.