I’ve had several people ask about targeting the bit level/bitness/platform of Windows with Group Policy Preferences using Item Level Targeting who were having problems getting it to work properly. Before we jump in, I should probably define bitness since I only first heard the term a few months back (Sorry… no… I can’t claim credit for making it up…). There’s an MSDN glossary entry that has very geeky sounding definition: “The distinction between 32-bit and 64-bit address spaces, and the potential differences in instantiation of components that this entails.” The less geeky, but easier to explain to your co-workers and/or boss definition is that we want to determine whether the operating system is 32-bit (x86) or 64-bit (x64) so we can selectively apply a Group Policy Preference setting.
Depending on who you talk to, what videos you watch, or blogs you read, you could hear this called anything from bit level to platform to bitness. In the end, all we care about is whether we’re talking x86 or x64 of the Windows OS. We’re not talking about processor capabilities or anything else other than the actual type (x86 or x64) of Windows installed on the box. I’ve seen all three terms used somewhat interchangeably (whether that’s correct or not), but I’m going to use “bitness” from this point forward because, frankly, it sounds the coolest.
So, if you’re running a typical install Windows XP Professional, your OS bitness is most likely 32-bit since that is typically the most common variant of that OS. If you’re running a brand new touch screen laptop with 8 GB of RAM and Windows 8.1 Pro, your OS bitness is most likely 64-bit if you’re taking full advantage of the hardware.
Because there are some differences between the 32-bit and 64-bit versions of Windows, there may be times that you need to target your Group Policy Preferences to a particular bitness to make sure your settings are being applied correctly. The biggest thing I typically hear is that someone needs to target a 32-bit application on both 32 and 64-bit Windows. Let’s look at Windows 7 x64:
Microsoft puts 64-bit applications in C:\Program Files\ and put 32-bit applications in C:\Program Files (x86)\ on the 64-bit editions of Windows. The only problem is that now, your 32-bit application is living in C:\Program Files\Super Widget Maker\SuperWidgeMaker.exe on all your 32-bit systems and C:\Program Files (x86)\Super Widget Maker\SuperWidgeMaker.exe on all your 64-bit systems. Group Policy Preferences to the rescue, right? You’ll just target the Operating System and you’ll be good to go!
Acutally, no. There are two problems with the built-in OS targeting in Group Policy Preferences. First off, you’re going to have to update your Item-Level Targeting every time a new OS comes out. The screenshot above is already out of date because it doesn’t include Windows 8.1. And, you can’t use it if you need to apply it to servers since you’ll need to add Server 2012, Server 2012 R2, etc. The other issue is that the setting in the screenshot above will actually target both 32 and 64-bit. Yep, the Operating System targeting for “Windows 8 Professional” will hit both x86 and x64. And, to make matters even worse, there’s a known problem with Windows 7 and item-level targeting of 64-bit versions that requires you to install a hotfix on all your Windows 7 x64 systems. ARG!
So how do we get around this limitation in Group Policy Preferences that makes us update the policy every time a new OS comes out and guarantee a hotfix is installed on all of our Win7-x64 systems? Actually, it’s fairly easy. There is a built-in Environment Variable in Windows we can use to identify the bitness of Windows.
In your Preference, go to the Common tab and click the checkbox next to Item-Level Targeting. Once you’ve done that, click the Targeting… button.
That’s it! The biggest thing here is to not be confused by the name of the Environment Variable, %Processor_Architecture%. The name seems to imply that your processor is either x86 or AMD64; but, this actually refers to the bitness of Windows, not the capabilities of the processor:
Windows x86/32-bit %Processor_Architecture% = x86
Windows x64/64-bit %Processor_Architecture% = AMD64