Jump to content


How can I check for network connectivity before starting a task sequence in System Center 2012 R2 Configuration Manager ?

Recommended Posts



I've been thinking about doing something with this issue for some time now and finally got around to implementing it, however credit where credit is due I've based this on a method developed by a colleague of mine (Magnus Mourujärvi) to work with a 3rd party's custom boot wims. Basically that method is a registry hack which takes place in the boot wim.




We've all seen this happening, you get new hardware, you PXE boot, it pulls down the boot wim but as you don't have network drivers in your boot wim the task sequence won't run, or worse it just reboots without telling you why. checking the SMSTSLog will give you clues as to the problem...


unknown host.png


Troubleshooting it further would involve doing some clever use of wbemtest to find out what the network card pnp device id is in order to identify what the right driver is to be added into your boot wim. It was this process that I wanted to simplify, making it easy to identify the problem and the helping the user identify the Network card in question.




Add two files to your boot wim, update them to the distribution points and sit back and watch the show. Well ok, not quite that easy, there are some steps to do, documented below.


Step 1. Get the script


Note: there is a newer version of the script here which also checks for SATA connections (storage)


Download the CheckForNetwork.vbs script here. Yeah it's a vbs, if I get time I'll convert it to PowerShell.




Extract it to C:\Temp


In the script locate the ServersToPing array




and edit it to match one or more servers you want to ping in your address, and save the script.


Step 2. Copy a file from the MDT 2013 Toolkit


Locate your MDT Toolkit files package and browse to the folder matching the architecture of the boot image you intend to edit, for example if you plan on editing the x64 boot wim then use a path similar to below:


\\sccm\d$\sources\os\MDT 2013\Toolkit\Tools\x64


Locate a file called windowhide.exe and copy it to C:\Temp


Step 3. Create some temp folders


On the C:\ of your chosen server, create the following folder structure

  • C:\Mount
  • C:\WinPEMount\
  • C:\WinPEMount\X64
  • C:\WinPEMount\X86

Step 4. Make a copy of your boot wim


Identify your target boot wim in the Configuration Manager console as shown below, this will be the boot wim we are going to make changes to...


locate boot image.png


Right click the boot wim and select the data source folder, make a note of the Image Path


boot wim data source.png


Make a backup copy of the boot wim (ctrl+c and then ctrl+v) and then copy the boot.wim file (or WinPE.wim if it's a MDT created boot wim) to C:\Mount as shown below.


boot wim in mount folder.png


Step 5. Mount the boot wim and make some changes


Using Run as Administrator, start the Deployment Imaging and Tools Environment cmd prompt as shown below


Run As Administrator.png


In the CMD Prompt that opens, mount the boot wim by issuing the following command:

dism /mount-wim /wimfile:c:\mount\boot.wim /index:1 /mountdir:c:\winpemount\x64

Tip: In the above command i'm mounting a Configuration Manager boot image called boot.wim, if this was a MDT Created boot image it would be named WinPE.wim.


mount boot wim.png


Now that the boot image is mounted, we can make our modifications. First we will edit a registry key but to do that, we need to mount it.


Using REG.exe mount the SYSTEM hive of the mounted boot wim

REG.EXE load HKEY_LOCAL_MACHINE\Mount\ "C:\WinPEMount\X64\Windows\System32\Config\SYSTEM"

Once done, change the current value for CmdLine in the mounted registry hive to run our script instead

reg add "HKEY_LOCAL_MACHINE\Mount\Setup" /v CmdLine /t REG_SZ /d "cscript.exe CheckForNetwork.vbs" /f

Next we commit those changes to the mounted registry


and now we copy two files from C:\Temp to C:\WinPEMount\X64\Windows\System32 (assuming you are editing the x64 boot image)

copy c:\temp\CheckForNetwork.vbs c:\WinPEMount\x64\Windows\System32
copy c:\temp\windowhide.exe c:\WinPEMount\x64\Windows\System32

Now that we've made our changes, we want to commit them to the boot wim (write the changes)

dism /unmount-wim /mountdir:c:\WinpeMount\X64 /commit

as shown below


commit the changes to the boot wim.png


Step 6. Copy the modified boot wim back to the Image Path in Step 4.


Now that we've made the changes we need, copy the modified boot wim from C:\Mount back to it's original location


copy back boot wim.png


Step 7. Update your boot image to the distribution points


In the Configuration Manager console, locate your boot image, right click and update it to the distribution points as shown below


update distribution points.png


Once done you are ready to test the new functionality in the boot image.


Step 8. Review the changes


If the network works ok in WinPE, the task sequence will load as normal and you won't see any popup, or notice anything other than an additional 12 seconds added to your boot time.


pxe password.png


However, in the event that you have no network and cannot ping any server in the array of server IP's listed in the script, you will see the following warning popup after WinPE starts (before the PXE password and before a task sequence is selected).


Note: The script try's to hide Wireless nics from being displayed in the results as we don't use wireless nics for OSD, yet.


yes no cancel.png


As you can see from the message it provides the following info

  • a reason for the popup (no network connectivity)
  • lists the detected Network Card
  • lists the PNP Device ID
  • identifies the Computer model

and gives the user some options

  • click YES to retry (for example if the network cable was not connected)
  • click CANCEL to open a CMD prompt if further troubleshooting is needed
  • click OK to reboot.

Below you can see what happens when the user clicks on Cancel


clicking on cancel.png


well that's it ! have fun :-)




  • Like 1
  • Thanks 1

Share this post

Link to post
Share on other sites

no, as that will happen too late in the process, ie it will have already failed at that point, so we have to do it this way

Share this post

Link to post
Share on other sites

approximate 5 minutes to display the message



did you modify the wscript.sleep statement at all, it should only wait a maximum of 15 seconds.

Share this post

Link to post
Share on other sites

well rem out the 'hide the cmd prompt' so that you can see what is going on, did you make any changes at all in the script ?

Share this post

Link to post
Share on other sites

well it should work just fine (it does here and we are using it in production)

where exactly are you see the 5 minute delay, can you video it so i can see ?

Share this post

Link to post
Share on other sites

Thanks for a very good guide on how to implement this. I had no problems in modifying the boot.wim file and succesfully updated it on the DPs. I started a installation on a virtual machine, VMware machine with Intel E1000 nic, and there were no problems starting the Task Sequence, but after the step: Setup Windows and Configuration Manager the Task Sequence initiates a reboot and after that it halts and loops trying to,


At the same time two of my colleagues initiated the installation of, One physical machine, HP 10140 and on one Hyper-V virtual machine, with the same result as me on the virtual machine I was running the TS on.


"Windows is starting up" and then "Preparing network connections" over, over and over again.... in an endless loop until I shut down the machine.


- I looked through SMSMTS.log, didn't see anything special.

- The "Setup Windows and Configuration Manager" step is just after "Install Drivers" and I wonder if this might have anything to do with the problem.

- In the script, CheckForNetwork.vbs, it looks for: (description LIKE '%ether%') OR (description LIKE '%network%'), When I look at the description of the NICs on these 3 machines, the descriptuion contains Ethernet and Network. At the moment this is the only thing that I have found different and I wonder if %ether% and %network% might be case sensitive?


Any other suggestions?





Share this post

Link to post
Share on other sites


this guide is not supposed to assist you with lack of network drivers AFTER you start a task sequence, but before you start one,


and your issue sounds like the latter, do please attach your smsts.log files here so we can figure out why

Share this post

Link to post
Share on other sites



Yes, that was the reason for me trying to implement this into the boot image. However the task sequence and the boot image had been working fine on these machine types up until the implementation of the script. No changes have been made in the driver packages for these machine types, and when reverting back to the boot image that I used Before implementing the script there's no problem. So I don't think there's a lack of any network adapters for these machine types.


I'll will try set up the boot image with the script again to generate the SMSTS.log file, hopefully I'll can fix it during the day....



Share this post

Link to post
Share on other sites

well you can simply change the boot image referenced in the task sequence to quickly switch between boot wims, i'd definetly be interested in seeing your smsts.logs

Share this post

Link to post
Share on other sites

In my previous issue, i mentioned that there is delay of 5 minutes. i commented the line objShell.Run("x:\windows\system32\wpeinit -winpe"),1,true. then the delay is removed but script not proceeding if machine is connected to network.

Share this post

Link to post
Share on other sites

that line must run otherwise the network will never initialize and neither will winpe.


I've tested this over and over and it works great, so something is up on your end, if have access to virtual machines to test this and have teamviewer i can take a look.

Share this post

Link to post
Share on other sites

Sorry, but I have been in meetings during the day that took som more time than I expected... I have to correct my previous statement. When the task sequence loops it loops by saying the following: "Initializing Hardware Devices" and then "Windows is starting up" and again and again....

Share this post

Link to post
Share on other sites

ok you must have made some error in the script, please re-download it, and retest it after changing only the ip addresses

Share this post

Link to post
Share on other sites

Had some time to try this again today. I downloaded the script again, edited the IP-addresses. Made a copy of the boot-image we are using and added it back again as a new boot image. I the used this copy to use in your guide. I added back the vmware network drivers to the boot image as I was going to test this on a virtual machine within vmware. Same result with a twist, after the step "Setup Windows and Configuration Manager" the TS fails but when clicking ok in the backround the "Initialize hardware" runs and the the error pops up back again. See attached files.....





Share this post

Link to post
Share on other sites

can you clarify what you mean here please


clicking ok in the backround the "Initialize hardware" runs and the the error pops up back again. See attached files.....


Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...