Reputation: 217
I am trying to detect whether a device's processor would support a 64-bit Windows Operating System installation without paying any attention to the bitness of the Windows Operating System installed on it at the time of the check. I am looking to do this via PowerShell (3.0 minimum), but I can also employ Batch or VBScript by invoking cmd
and cscript
respectively. The code must be executable via a non-interactive script, with values being returned without any need for user interaction.
The following methods do not work on my testing device, a 32-bit Windows 10 VM which the Settings app identifies as containing an x64-based Processor:
I noted above that the Settings app can gather this information to tell a user that their device would theoretically support installation of a 64-bit Windows Operating System. Knowing this makes me loth to use a third-party command-line tool (although it remains a viable last resort).
The use case will be to perform this check and then spin off an if
clause with the information.
Upvotes: 1
Views: 3099
Reputation: 51
Using VB Script you can check AddressWidth for OS type and DataWidth for CPU type. Put the following in a .vbs file:
address_width= GetObject("winmgmts:root\cimv2:Win32_Processor='cpu0'").AddressWidth
data_width= GetObject("winmgmts:root\cimv2:Win32_Processor='cpu0'").DataWidth
WScript.Echo "Running " & address_width _
& " Bit Windows on " & data_width & " Bit processor."
There are plenty of ways to determine whether Windows is 32 or 64 bit - but this is the best way I've found to check the Processor type. Took me some time to find it so I thought I'd share in case anyone else is looking :-)
Upvotes: 1
Reputation: 10799
The Win32_Processor
WMI class has a property Architecture
. This takes the following values, based on the processor type:
So, on a computer with a Core i7 processor, (Get-WMIObject -Class Win32_Processor).Architecture
will return 9
, telling you that it's an x64 processor - even if you've installed a 32-bit Windows on it.
Upvotes: 6