I stumbled upon the script from Brian Mason: SMS Client Health Script Since the use of this script the failures of clients have minimized. But then the customer decided to upgrade their SMS environment to SCCM 2007. Since I didn't know if the script was SCCM complient I started searching on the internet. There I found the blog of Shaun Cassels with an updated version of the script.
We tried that script and found a little problem during deployment. When a client is being deployed the client is reassigned to another SCCM Site server. The deployment server is a seperate server. Bummer.
Did some hobbying arround and came up with the following
Made changes are:
If WKS_ASSIGNSITECODE is not equal to AUTO have the sitecode set in the client to the requested
If the installation is still ongoing in a different site ( PXEInstallationSite ) the reassignment will not occur and the script will exit.
' ============================================================================= ' Method: CHK_ASSIGNMENT ' Description: Checks Client Site Assignment ' ============================================================================= Dim PXEInstallationSite = "S01" Sub CHK_ASSIGNMENT On ERROR Resume Next Err.clear COLLECTMSG "CHK_ASSIGNMENT",">",NULL Dim oSMSClient Set oSMSClient = CreateObject ("Microsoft.SMS.Client") If err.Number<>0 Then COLLECTMSG "CHK_ASSIGNMENT","ERROR", Err.description COLLECTMSG "CHK_ASSIGNMENT","Could not create SMS Client Object - Quitting", Null Else ' BSt modification start Dim mySMSSite mySMSSite = oSMSClient.GetAssignedSite if mySMSSite = PXEInstallationSite and objFSO.FolderExists("c:\_SMSTaskSequence") then wscript.quit End if ' BSt modification end If Len(mySMSSite) = 0 Then CLIENTSTATE = CLIENTSTATE + 1 RegCounter "CHK_ASSIGNMENT",1 If WKS_ASSIGNSITECODE = "AUTO" Then 'have the client determine from AD or SLP appropraite site code oSMSClient.ReAssignSite COLLECTMSG "CHK_ASSIGNMENT", _ "Error - Client not installed correctly - Setting AUTO", _ Null StrERRType=StrERRType & "ASSIGNMENT_" Else oSMSClient.SetAssignedSite(WKS_ASSIGNSITECODE) COLLECTMSG "CHK_ASSIGNMENT", _ "Error - Client not installed correctly - Setting " &_ WKS_ASSIGNSITECODE, Null StrERRType=StrERRType & "ASSIGNMENT_" End If Else COLLECTMSG "CHK_ASSIGNMENT",">", "Assigned Site = " & _ oSMSClient.GetAssignedSite End If End If Set oSMSClient=Nothing End Sub