OSD Pre-Flight Checks

Posted: May 6, 2015 in Configuration Manager, System Center Configuration Manager 2012
Tags: , ,

As a consultant, I have done numerous installations of Configuration Manager and one of the things that usually generate problems is when tasks are delegated from the Configuration Manager team over to other parts of the organization or third party. This solution will catch some of the most common issues that occur when handing over OSD to another team.

You as a deployment expert and the person who set up and have full control over your Configuration Manager environment will catch most of these issues without this tool. However, if a person on first line support is given the task to deploy new computers to end users he or she has no clue on what’s set up in the background and this tends to generate issues. An example being, deploying a computer model that has no driver packages assigned.

So I wanted to create a simple tool that check for the most common issues at the very beginning of the task sequence, no one wants to wait for several minutes just to find out that there is no driver package for this model. There are some solutions for this already out there but they are usually part of a UDI/Front-End solution or steps in the Task Sequence that give hard failure and fails the task sequence without any options to correct the problem. Therefore, I ended up with these criteria’s,

  • Must be dynamic, only appear if something will/could prevent the task sequence from completing successfully else continue as normal
  • Errors or warnings must appear at the very beginning of the task sequence, and it must be possible to correct these without the need for re-starting the task sequence
  • Provide information about the computer in case of an error or warning

What I ended up with looks like this in action:


In this posting I’ll walk through how to set this up


You need to have enabled HTA-Support in your boot image for this solution to work.
You can find a step-by-step guide here on how to enable HTA-Support; http://www.petervanderwoude.nl/post/add-hta-support-to-a-boot-image-with-configmgr-2012/

  1. First, download the OSD Pre-Flight Checks Solution and extract it.
  2. You’ll then have a folder with these files
    2background.png (Can be replaced with your own custom background)
    ComputerModels.txt (this is the file where we add the computer models currently supported in our environment)
    green.png (Image file used in the GUI)
    logo.png (Replace with your company logo)
    PreFlight.hta (the actual program that will run)
    red.png (Image file used in the GUI)
    warning.png (Image file used in the GUI)
  3. Fill out the Computer Models that is supported in your environment in the ComputerModels.txt file, one on each line. I’ve added these:
    ComputerModelsYou can find this value in WMI on your system in the Win32_ComputerSystemProduct Class in either Name or Version Property depending on you Manufacturer, both Name and Version property is supported by the solution. If you try to deploy to a computer model that is not in this list you can also find this value i the Model Field in the GUI of the OSD Pre-Flight Checks solution.
  4. Edit the PreFlight.hta with a text editor, I prefer to use Notepad++, but Notepad will work fine also. Find line 154 and add the IP of the servers you want to ping to check for Network Connectivity;
    ServersToPing=Array("", "", "")

    I have filled in the IPs of my Domain Controller and Configuration Manager infrastructure, as these are the servers my client’s needs access to during the Task Sequence.

  5. Copy the all of the files from above to a file share that is accessible from the locations where OSD will occur, I’ve created a file share on my fileserver \\thinkit.no\PackageSource$\Scripts\OSD Pre-Flight Checks
  6. I recommend locking down the rights on that folder and files to the minimum needed, so you have control over who can edit the ComputerModels.txt file and change other settings in the files.
  7. Edit the task sequence, create a new group at the top and name it “Pre-Flight Checks”. Add a step under this to map a network drive, I’ve selected Z:\ and map the share specified in step 5, I’ve used the Network Access Account to map the drive, as this account have the necessary rights (read/execute) to this share in my environment.
  8. Add a run command line step, type in Z:\PreFlight.hta in the command line field and set it to start in Z:\.
  9. Next I need to add some conditions on the Execute Task Sequence Group
    • IsOnACPower
    • IsSupportedHardwareModel
    • IsUSBDriveAttached
    • IsOnNetwork
    • IsDiskEncrypted
    These are the Task Sequence variables passed to the Task Sequence from the solution.
    So I add these with the following settings;
    8IsDiskEncrypted will throw a warning in the GUI if disk is encrypted on the computer where you run the task sequence, but will give you the ability to continue the task sequence. So you need to decide in your environment on how to handle this. If you set this to FALSE you will not be able to run the task sequence on computers that have encrypted disks. So in most cases you would not specify this variable on the Execute Task Sequence Group. The reason for the warning is that you most likely will run out of space on the reserved partition before you get to the Format and Partition Disk step and the task sequence will fail. So this is just to give a heads-up that the disk is encrypted and it could cause issues if you don’t have a solution for handling disk that are encrypted in your task sequence already.
  10. We are now ready to test our task Sequence with the Pre-Flight Checks.
    Below are some screenshots of the solution in action, remember that if all checks passes with success you’ll not see this information since it will automatically close, this is to prevent that deployments that will work stops and wait for interaction.

You can download the OSD Pre-Flight Checks solution from here and please provide feedback if you find this solution interesting.

Download OSD Pre-Flight Checks
  1. alexandrelizarov says:

    Thank you! This is fantastic Staff! Where did you find these varibales IsUSBDriveAttached and other? I tried to find it here https://technet.microsoft.com/en-au/library/hh273365.aspx
    and here http://www.hayesjupe.com/sccm-and-mdt-list-of-variables/ but I didnt find. And one more question is it possible to use you staff with MDT?
    Thank you.

  2. Derek Goudie says:

    Thanks for sharing your solution. But I’m wondering how the TS runs the “Connect to the Network” step…if there is no network?

    • Robert says:

      So I am assuming you are running the task sequence from media then? In this case you would have to use a package that contains the pre-flight check hta script and other files including the hardware model text file.

  3. kapitulpa says:

    If you check “Continue on Error” on the Execute Task Sequence, all tasks below this Group can potentialy fail but finaly the Task Sequence ended with Successfull message. No more Error dialog is shown. How can you handle errors and failed the TS if necessary ?

  4. line 114 contains an error where as the “StrFilePath” is written as “strFilePath”.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.