I am trying to figure out if there is a location in WMI that will return the OS Architecture (i.e. 32-bit or 64-bit) that will work across "all" versions of Windows. I thought I had figured it out looking at my Win2k8 system when I found the following:
Win32_OperatingSystem / OSArchitecture
I was wrong. It doesn't appear that this field exists on Win2k3 systems. Argh!
So, is anyone aware of another field in WMI that "is" the same across server versions? If not, what about a registry key that is the same? I am using a tool that only allows me to configure simple field queries, so I cannot use a complex script to perform.
Any help would be greatly appreciated.
I know this is old, I am posting this for anyone in the future. Try looking at my script. It's written in BATCH and uses WMIC if it is on the computer but does not need it in order to determine whether the OS is running a 32 bit of 64 bit OS.
You can try the syntax below using wmic to determine the platform:
This isn't exactly what you asked for, but I just used this in a WMI query (Group Policy Preference targeting) and it appears to work thus far:
The simple WMI query that you used does indeed return a result for every physical CPU in the computer. It will only return one result if you have a single processor, multiple core CPU. We can safely assume the computer has atleast one CPU, so lets just use the information from CPU0.
To select only 64-bit operating systems...
To select only 32-bit operating systems...
The environment variable 'PROCESSOR_ARCHITECTURE' is all that is needed. Just like the registry call this will return either 'AMD64' or 'x86'.
Try this: