Category Archives: osd

Automatically Apply Regional Settings by IP

Here at the company I work for, we have a number of offices scattered around the world. Computers imaged at each office have to be placed in an OU specific to each office, have an office-specific Local Admin password set, and have the timezone set. Originally, we had a separate Task Sequence for each office, and we’d have to pick the right one. Unfortunately, this also meant that we had at least 5 of each Task Sequence, which made updating software packages pretty tedious, as we’d then have to update them in each TS.

I didn’t want to create an HTA to have the local IT guy manually select an office, and I was also averse to having the local IT guy enter specific values in the form of a Task Sequence Variable. Our offices each have well-defined subnets, so I knew there’d have to be a way to have the task sequence automatically apply these regional settings based on the IP address. Here’s how to do it (note: these instructions are for SCCM 2007; I’m not sure how they’d need to be modified for SCCM 2012 at this time):

  1. Start by closing out of the Configuration Manager Console on the Site Server
  2. Download Microsoft Deployment Tools (MDT) 2012 and install on the Site Server.
  3. After installing, go to Start > All Programs > Microsoft Deployment Toolkit > Configure ConfigMgr Integration.
  4. You’ll want to select the radio button for Install the MDT extensions for Configuration Manager, and check the boxes for Install the MDT console extensions for ConfigMgr 2007 and Add the MDT task sequence actions to a ConfigMgr server:
  5. Next, re-launch the Configuration Manager Console and create a new package (I just called mine “MDT”). You’ll want to set the source to the location of the “Templates\Distribution” folder within your MDT installation (using the UNC path). For me, that was “\\[SiteServer]\c$\Program Files\Microsoft Deployment Toolkit\Templates\Distribution”.
  6. Distribute this package (no need to create any programs here) to your Distribution Points as normal.
  7. Open up the Task Sequence you want to modify. I created a new group within this TS and called it “Regional Settings,” and put all the following steps within that group just for organization.
  8. In the Task Sequence Editor, select AddMDTUse Toolkit Package. Click on this step and add your Toolkit Package by clicking the Browse button and locating your MDT package.
  9. Add another step: AddMDTGather, and specify for that step to Gather only local data (do not process rules).
  10. Now, let’s create a group for each region/office. Each group should contain the Apply Windows Settings and Apply Network Settings steps, with Local Admin password, Time Zone, and OU set accordingly (and any other region-specific settings; I’m working on having the task sequence install a Language Pack for our German office as well, but haven’t gotten that far yet). I also included a Set Task Sequence Variable step called “Set Location Variable” in which I create a TS Variable called “OSDLocation” and assign a specific two-letter code, because I’ll probably eventually start assigning specific software titles to specific offices as well.
  11. For each group, click the Options tab and click Add Condition. First, we’ll add an If Statement, to run if Any conditions are true.
  12. Under that If Any statement, click Add Task Sequence Variable. The Variable we’re going to be looking at is called DefaultGateway001, and we’ll want to set it to equal whatever this office’s Default Gateway is. Some of our offices have multiple possible Default Gateways, so you’ll just want to set this for any possible Default Gateway in each office.
  13. Test your Task Sequence! It should image successfully, and show up in the correct OU, with the right Time Zone and Local Admin password.

You’re all set! If you have any trouble with any part of this, please leave a comment below!

OSD Hangs on “Installing Updates” Step

We were experiencing an issue at one of our remote offices where our OSD task sequence would get stuck right before it began installing updates (Windows and Office Updates). This issue seemed to only affect machines that were already in SCCM’s database; unknown machines were unaffected. The issue was most prevalent in one specific remote office (affected approximately 60-70% of machines being reimaged), but was documented only sporadically at other offices. For what it’s worth, our environment is SCCM 2007 R2 running on Windows Server 2008 Enterprise.

My first inclination was that there were just too many updates involved. I built a new Windows image that already included all of the Windows 7 updates that we’ve deployed to-date (a good practice we’ve decided we should do every few months anyway, just to cut down on OSD time). Unfortunately, this still did not work.

A bit of Googling yielded promising results: a hotfix available from Microsoft- “Task sequence that installs many updates stops responding on a System Center Configuration Manager 2007 SP2 client.” Perfect! I downloaded the hotfix, and proceeded to install it on the Site Server. Once that’s done, it also creates a new package called “KB2509007 – Advanced Client Hotfix – [Site Code]”. I had our remote techs try kicking off some OSD at this point, but apparently, I’d jumped the gun.

At this point, what needs to be done is to update your “Microsoft Configuration Manager Client Upgrade 4.0 ALL” package on all your Distribution Points. Also take note of this package’s Package ID, as you’ll need to add the following to the Installation Properties of your “Setup Windows and Configuration Manager” step in each of your Task Sequences:

PATCH=”C:\_SMSTaskSequence\OSD\[Package ID for Client Upgrade 4.0] \i386\hotfix\KB2509007\sccm2007ac-sp2-kb2509007-x86-enu.msp”

Once this is added to your OSD TSs, and the package is updated on your DPs, your Task Sequences should stop hanging during the Installing Updates step!

Capture Task Sequence Logs during OSD

SCCM has this really annoying habit of not keeping TS logs accessible after completing an OSD task sequence. Unfortunately, this also applies when the TS fails. To combat this problem, I implemented the following solution from Steve Rachui, which moves the TS logs to a network share for proper archiving and ease of access.

To do this, I added a new group to my main task sequence called Log Upload. I selected the “Log Upload” group and went to the Options tab, and added a Task Sequence Variable condition wherein we check whether _SMSTSLastActionSucceeded equals false. If so, it executes the group. I added four steps to this group:

  1. Connect to SMSTSLogUploads – This is a Connect to Network Folder step, which connects to a folder on our SAN using our SCCM service account, mapping it to Z:\.
  2. Erase pre-existing folder for machine – This is a Run Command Line step, which executes the following command line step to delete any folder that had already been created for the machine being imaged: cmd.exe /c rd /s /q z:\%_smstsmachinename%%
  3. Create log folder for current machine – This is another Run Command Line step, which creates a folder on the share for the computer currently running the TS: cmd.exe /c md z:\%_smstsmachinename%%
  4. Copy logs to folder – Our last step, also a Run Command Line step, this actually handles the copying of the log files to the newly-created folder: cmd.exe /c copy %_smstslogpath%\*.* z:\%_smstsmachinename%

It’s important to set this whole group to “Continue on Error,” otherwise it will fail if any of the individual steps fail, and report your entire TS execution as a failure. In my first test run, I hadn’t set this option, and the TS failed when it wasn’t able to delete the not-yet-existing folder on the share in step 2. Note that you’ll also want the preceding steps to continue on error as well, otherwise the TS won’t even get to this part on failure.

Next time, I’ll talk about using a script to send an alert email when a task sequence fails!