I create Group Policy Objects for years and I am often consulted to solve GPO issues. Lately I had to debug GPOs created by an IT admin. This GPO has applied randomly on the workstations.
All these GPO use the following WMI Filters to identify 32 and 64 bits computers (PLEASE, KEEP READING BUT NOT USE THESE WMI FILTER):
SELECT * FROM Win32_OperatingSystem WHERE OSArchitecture="32-bit" SELECT * FROM Win32_OperatingSystem WHERE OSArchitecture="64-bit"
At the first glance, everything seems to be OK. A brief Google search brings me a LOT of blog/documentations with this filer. Some people indicates to use SELECT * FROM Win32_OperatingSystem WHERE OSArchitecture = “64-bit” for 32 bits (spoiler: don’t use it).
So, what is the problem? I ran a Get-WMIObject -Query ‘SELECT * FROM Win32_OperatingSystem WHERE OSArchitecture=”64-bit”‘ and I get… nothing… it’s odd because my computer is a 64bit CPU and OS.
After, I try Get-WmiObject -Query ‘SELECT OSArchitecture FROM Win32_OperatingSystem’ :
With this command, I got the culprit: on my system, installed in french language, the OS Architecture value is 64 bits and not 64–bits (note the dash).
So, please, if you work in multi-language environment (or even if any environement), prefer to use the following WMI Filter:
32 bits : SELECT AddressWidth FROM Win32_Processor WHERE AddressWidth="32" 64 bits : SELECT AddressWidth FROM Win32_Processor WHERE AddressWidth="64"