Client Health Startup Script and OSD
For several years now I have been an advocate of not using AD System Discovery in ConfigMgr…mainly because AD always has dead machines accounts. I don’t want those dead machines cluttering up ConfigMgr. I prefer to use a GPO startup script to both install the client and to make sure the client stays healthy. I have used variations of the DudeWorks/1E/Shaun Cassells script.
I have run into one issue with this script during OSD. During my automated deployment using ConfigMgr, I am automatically joining the computer to the domain…into the OU that I want the workstation to be in long term…which is the same OU that I have the health script GPO applied to. The problem is that the startup script checks to ensure that the ConfigMgr client service is running. During OSD…it is not. This causes the script to kick off actions that will mess up OSD. I recently added some code to the script to keep this from happening. It was actually pretty easy…just try to connect to the Task Sequence Environment. If it is able to successfully connect…exit the script. If not…keep going. Here is the code I added:
‘=============== Load/Create Objects =====================================
‘ Don’t run if a Task Sequence is running.
On Error Resume next ‘this line is only necessary if it hasn’t already been set in the scriptDim env: Set env = CreateObject("Microsoft.SMS.TSEnvironment")
If Err = 0 Then WScript.quitOn Error GoTo 0 ‘ this line is only necessary if the script should NOT have “On Error Resume Next” enabled
I would also like to completely update the script…will post it when/if I get the chance. Most of what I would do is standardize the variables (objShell, oShell, WSHShell are all used in the script if I remember correctly…and all are the same thing). I’d also like to set the tabs/indents to make it look cleaner and more organized. But first…I need to get time to do so which isn’t easy to do when I’m already working close to or above 50 hours a week.
Hi Jarvis,
I would like to see just a plain as is script that you are running now – so I can compare it to what I am using. If you dont want to post it here, please send a copy to my email address.
Thanks for the cool blog!
Thanks Dan. The script I am using comes from:
http://myitforum.com/cs2/blogs/scassells/archive/2009/04/14/sms-2003-client-health-startup-script-v4-19.aspx
Be sure to read the comments posted on that page and make appropriate changes.