How to check if OS is 32 or 64 bit?

Mar 17, 2016 at 1:07 AM
How can I check if the OS is 32 or 64 bit?

I'm using this to run a batch script to install the proper drivers.
Mar 17, 2016 at 2:32 AM
The limitation of MSI as a deployment technology is that it cannot be built as "neutral". You need build your MSI as x64 or x86 installation package (samples are available).

Though you can build your Bootstrapper or custom external UI that can detect the OS CPU architecture ind invoke one or another embedded MSI.
Marked as answer by jacobvoll on 3/18/2016 at 3:55 PM
Mar 17, 2016 at 8:48 PM
Okay, that's good information about an MSI's limitation, and because of that it makes sense that there's no function to facilitate getting that information.

However, in my case the program installed is an x86 no matter what the OS is, so I don't need to switch the MSI. However, after installation I'm attempting to install a driver which does require the distinction between 32 and 64 bit.

I took a look at the bootstrapper examples to see how I could switch from those, and got the idea to do a registry check. I ended up with this in a AfterInstall process:
RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Hardware\Description\System\CentralProcessor\0");
string value = key.GetValue("Identifier").ToString();
if (value.Contains("x86"))
//do x86 stuff
Thanks for your help, and thanks for Wix#!
Mar 18, 2016 at 12:32 AM
And if your bootstrapper is .NET 4 (most likely it is) you can use even more direct approach:
if (!Environment.Is64BitOperatingSystem)
    //do x86 stuff
Mar 18, 2016 at 11:54 PM
Thanks oleg! I like that a LOT better.

aside: I'd think it would be easier to find that solution, as opposed to the myriad of other ways suggested around the 'net. Apparently there are a lot of bad suggestions floating around that question.