Jump to content




anyweb

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



Recommended Posts

Introduction
In a previous post I showed you how you can check for network connectivity before starting a task sequence in Configuration Manager 2012 R2. In this post I'll add a newer script to also check for storage (SAS, SATA, SCSI, Storage). The added code gives you new abilities to deal with hardware that has changed for whatever reason and it allows you to quickly identify the problem, and identify the storage vendor id and device id so that you can go looking for drivers.

 

As storage is a must (the task sequence must write temp files on your hard disc and also copy packages) adding this change to the script was inevitable. I hope you like the results.

 

Get the new script.

Here's the updated script

 

CheckForNetwork.zip

 

simply replace the earlier script with this one as documented in the process detailed here.

 

Note: if you downloaded the script prior to 2015/4/22 then please download it again as there's a newer version here with fixes and logging added. The new script logs to X:\Windows\Temp\SMSTSLOG\checkfornetwork.log

 

See the results

After implementing the new script in your boot image this is what you'll see when it detects missing storage drivers.

 

warning unable to continue.png

 

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

  • a reason for the popup (no storage detected)
  • lists the detected storage controller
  • lists the PNP Device ID
  • identifies the Computer model

and gives the user some options

  • click OK to reboot.
  • click CANCEL to open a CMD prompt if further troubleshooting is needed

In addition to the above, it also checks for network (if and only if the storage check above passes), and in the event of a network connectivity failure you'll see this

 

cannot connect to network.png

 

which 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.

Well that's it, I hope you like the update ! please test it and give me feedback

 

cheers

niall

Share this post


Link to post
Share on other sites


Can this same solution be implemented within MDT? I'm assuming so but don't know if it is just an edit of the LiteTouch WIM file or if there would have to be other steps as well.

Share this post


Link to post
Share on other sites

hi Tim, I havn't tried it in an MDT only environment yet, but i would imagine the results would be similar, feel free to beat me to it and post your results, in my testing I'm using SCCM CB with MDT integrated..and it works just fine

Share this post


Link to post
Share on other sites

hi, sounds super interesting and usefull I'll try to implement this with an mdt boot img

quick question before how would it reacts if it's a standalone image?

thanks!

Share this post


Link to post
Share on other sites

so I've implemented the script in an MDT 2013 update 2 boot image (integrated with sccm) , works great, detects when no network or when no disk, really really usefull, should be included by default :) Niall, thanks a lot for putting this together and sharing it!

Now... i'm sometimes using a standalone image, using the same boot image, is there a way in the script to detect it (or prestaged media) and bypass the network detection in this case?

yeah I could choose another boot image without the script but I have other customizations  as well and like to keep thing as simple as possible

thanks a lot

Share this post


Link to post
Share on other sites
Now... i'm sometimes using a standalone image, using the same boot image, is there a way in the script to detect it (or prestaged media) and bypass the network detection in this case? 

can you expand on this please ?

Share this post


Link to post
Share on other sites

well in a standalone image you don't need network connectivity to run the task sequence right? you can just run it from an usb key. But it's still using the boot image to boot in winPE at the beginning, so if we have a script asking for network in the boot image without any way to ignore it the task sequence can't start.

hope it helps, let me know if it still unclear?thanks

Share this post


Link to post
Share on other sites

right then the logic would have to change in the script, so that it knows if it's booted via standalone, and if so, skip the checkfornetwork step

 

check for the following variable

 

_SMSTSLaunchMode

 

Specifies the task sequence launch method. The task sequence can have the following values:

  • SMS - specifies that the task sequence is started by using the Configuration Manager client.

  • UFD - specifies that the task sequence is started by using USB media and that the USB media was created in Windows XP/2003.

  • UFD+FORMAT - specifies that the task sequence is started by using USB media and that the USB media was created in Windows Vista or later.

  • CD - specifies that the task sequence is started by using a CD.

  • DVD - specifies that the task sequence is started by using a DVD.

  • PXE - specifies that the task sequence is started from PXE.

  • HD – specifies that the task sequence was started from a hard disk (prestaged media only).

 

and based on the value it returns do the above...

Share this post


Link to post
Share on other sites

right, but I don't think the TS variables are already set up so early in WinPe (I may be wrong), that's why I was thinking an ignore button would just do the trick (there is probably more clever solutions but my coding abilities are somewhat limited)

Share this post


Link to post
Share on other sites

Any comments as to SCCM CB compatibility? I've implemented this in SCCM CB 1702 using a copy of our standard Win10 1607 boot image. It looks like the script is running and immediately exiting, and WinPE then immediately reboots, presumably because that's how WinPE seems to behave when there is nothing left to run.

Any ideas would be appreciated. Otherwise, I'll have to start a cycle of plopping pauses in the script and recompiling and redistributing the wim :/

Thanks,

== Matt

Share this post


Link to post
Share on other sites

we are using it in a SCCM 1702 CB environment with 1703 adk boot wims. no problems

you have probably made a 'mistake' in the script editing, causing it to fail and reboot, you can test the scripts 'manually'  by creating standalone media (usb) and testing that way... over and over

Share this post


Link to post
Share on other sites

Good to know. And good point. The only change I made was the edit of the IPs to check, but I probably got a little ambitious by replacing the IPs with a DNS hostname. I'll try swapping it out with the IP.

Thanks,

== Matt

Edit: Actually it looks like I messed up the wim injection. Disregard!

Edited by mmseng

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×