Thursday, April 3, 2014

SCCM 2012 R2 Windows XP refresh to Windows 7 Part 2

Part 2 of my post of how I made our transition to Windows 7 from XP please read my previous post or this one won't make much sense.

So we've created a task sequence and most of the pieces are in place for the successful deployment of Windows 7. However in my case I needed to deploy to laptops that only had WIFI access. In all the forums I read everyone says just don't do it. Well-- I'm going to do it. I have the bandwidth available and I don't want to have to touch every single computer to plug them up and image them.

So my task sequence looks something like this:


The first thing I had to do was to make sure all the content I needed was downloaded to the machine prior to the task sequence starting. This is a simple option to select when you deploy the task sequence under the Distribution page (or tab) select "Download all content locally before starting task sequence" from the drop down menu. This will ensure the image, boot image, driver packages, applications, etc will be downloaded to the cache on the computer before your sequence starts. This was required for as I stated in the previous post that WinPE3.1 did not contain the drivers I needed. I did not want to service WinPE offline to insert each driver individually. This got around that for the time being.

Now that you've selected the option to download the content locally -- depending on the size of the image, applications, and driver packages you'll need to increase the cache size from the default of 5100~mb. I increased mine to 10GB. Here is a script that I invoke to do just that.

On Error Resume Next
' Declare Variables
Dim checkCacheValue
Dim setCacheValue
' Set the Cache Size to check for (less than or equal to)
checkCacheValue = 6500
' If less than or equal to the checkCacheValue
' set the Cache Size to this
setCacheValue= 10000
Dim oUIResourceMgr
Dim oCache
Set oUIResourceMgr = CreateObject("UIResource.UIResourceMgr")
Set oCacheInfo = oUIResourceMgr.GetCacheInfo
' Set it if it's less than or equal to checkCacheValue
if oCacheInfo.TotalSize <= checkCacheValue then
oCacheInfo.TotalSize = setCacheValue
end if
'Return the error so SMS can report it

Copy this into a .vbs script and save it on a server that is accessible from the computer being imaged. I have a share that's readable by 'Everyone' in my domain.

I won't go into how to invoke that (command line step) If needed I will add it later. I will be focusing on required steps and details therein.

The next big one that kept causing my task sequence to fail is the "Set OSDisk Variable" step. This is only required in refreshes not bare metal installs. If you do not set this variable it will fail every time at the "Apply Operating System" step. This is to tell the Task Sequence which volume to apply the image.

So add a step "Task Sequence Variable" -> Name OSDisk -> Value C:

Everything down to the Apply Device Drivers step is default after creating a basic deploy task sequence. Here is where I had to get creative.

Since I wanted to deploy to laptops this step would always fail because it could not contact the MP to get a list of required drivers. So I customized this step to "continue on error" in the options tab. Fair enough. So I added the group: "Driver Install" within this group

 I added the option "Task Sequence Variable" - > Variable: _SMSTSLastActionSucceeded -> Value: False

If the Apply Device Drivers step failed then my custom group would fire applying specific driver packages that I needed. This part was a bit time consuming, but seems to work 100% of the time. I haven't seen a time yet that it has failed. You basically want to create and apply a driver package per model that is detected like so. For each step add a Apple Driver Package command. Name it appropriately and click browse to find the driver package that I hope you created earlier. then goto the options tab:

Add WMI query -> Default Namespace -> WQL Query -> SELECT * FROM Win32_ComputerSystem WHERE Model LIKE '%5400%'

(5400) will be specific to the laptop model you need. Here it's a Dell Latitude E5400. You will want to add a step for each laptop model you need.

Next step is Setup Operating System: This one I learned a few things. First off is the Setup Windows and ConfigMgr step is the step that actually joins the computer to the domain. The 'Apply Network Settings' step actually just adds the settings to the unattend.xml file to be applied here. So my dilemma was that even though the drivers were now installed for the laptop it needed a reboot for them to be applied by Windows. I know the Setup Windows and ConfigMgr step rebooted and applied the drivers, but joining it to the domain would fail 1. Because the drivers aren't applied yet. 2. Because if it's a laptop it's not joined to any networks yet. So I added the Setup Wireless group.

I set this group to only trigger if the computer was a laptop. I do not have MDT integration so the task sequence variable isLaptop is not available (to my knowledge). I had to use another WMI query.

In the default namespace I added this query: SELECT * FROM Win32_ComputerSystem WHERE PCSystemType = '2'

This query is only valid if the system is a laptop. I had to add this option because the next steps would fail on a desktop causing the whole task sequence to fail.

Next step is Add Profile SSID I used a command line step here to apply a wifi profile that I had saved into the image I was applying. (Creating WIFI Profiles is outside the scope of this post, I'll add it later) The command is this:

cmd.exe /C netsh wlan add profile c:\WifiProfiles\WIFI-Profile.xml user=all

This command will add the profile to connect to the SSID that I need. The next step will connect to that network if it hasn't done so already.

cmd.exe /C netsh wlan connect name=<Your SSID>

*NOTE Both of these WILL fail if you do not use the above query to confirm the device is a laptop.

After this I use a simple Join Domain step to join the computer to the domain.

Steps after this are not in the scope of this post so I'll leave it be for another time. Now when a computer running Windows XP is a laptop or desktop they will successfully image whether they're wireless or not.

I hope this helps someone else out. It took me about a week to gather all this data and make it work for me. I learned just because everyone says don't do it doesn't mean it can't be or shouldn't be done.

No comments:

Post a Comment