Tuesday, June 24, 2014

Determine OS arch to apply automatically

Overview

In my Windows 7 Task Sequence the tech can choose whether to apply a 64-Bit or 32-Bit OS WIM via a radio button in the HTA.


This allows a single Task Sequence to be used for the deployment of Windows 7 vs picking a different TS for each arch. 64-Bit is the default and our standard, with 32-Bit being the exception based on needs. There are a few older applications that require 32-Bit windows for things like 16-Bit installers. Based on what the tech selects, the HTA creates a variable called 'OSDBitLevel' and sets it to 'X64' or 'X86' and there are two apply WIM steps that will run based on the condition.



Now that I am beginning to work on a Windows 8.1 TS as part of my Tablet strategy I really wanted to leave 32-Bit behind, however Dell and others are using Atom procs or chipsets that do not have the x86-64 (aka AMD64) instruction set.  Therefore, I've set the mandate that these older applications will require Windows 7 if  used and that with Windows 8 forward the arch will be applied automatically based on the hardware. Its been removed from the Software XML the HTA references as an option and the HTA will now check what type of processor is present and if it supports 64-Bit it will apply that arch and if its a low end tablet for example, it will apply the 32-Bit image.

Since its done via my HTA, I have a simple vbs attached to do the same thing should you find it useful. Like my HTA, it sets a variable called 'OSDProcArch' and sets to '64' or '32'. Took me a little bit to settle on the best method but looking at CPU info in WMI became the most effective way. I like doing variables so I can use stuff elsewhere simply, but you can also do this via a WMI Query condition on each apply WIM step if you prefer.

 SELECT * FROM Win32_Processor WHERE DataWidth ='64'  

You can manually check it via command prompt by doing a 'wmic cpu get datawidth'. Don't confuse this with 'AddressWidth' which returns what the arch of the CURRENTLY running OS is, not what the CPU is capable of. 'wmic cpu' itself returns a wealth of useful information.

Download

This script is provided as-is, no warranty is provided or implied.The author is NOT responsible for any damages or data loss that may occur through the use of this script.  Always test, test, test before rolling anything into a production environment.

You can get the script here.