I’m in the process of piloting the DudeWorks/1E/Shaun Cassells SMS SCCM Client Health script. I’ve set it up so it runs in the user’s logon script. But there’s a bug with that.
- User FRED is the CONTOSO domain
- User FRED logons onto a computer which is part of the TOLERDO domain.
- SMS Client Health script tries to repair the TOLERDO domain computer
(not a good thing).
The fix?
Update the script to check to see if the user is logging onto a computer in their own domain. The scripts changes were:
- CONFIG Settings section
AddedsThisDomain="CONTOSO"
- In the START section, just after the Create Log file call
Added
' Check Domain to ensure a CONTOSO user isn't logging onto a TOLERDO PC.
Sub_Check_Domain
- And finally, added this subroutine:
Sub Sub_Check_Domain
If InStr(objSysInfo.ComputerName, LCase(sThisDomain)) = 0 Then
COLLECTMSG "Sub_Check_Domain","","A " + sThisDomain + " user has logged onto a non " + sThisDomain + " PC"
COLLECTMSG "Sub_Check_Domain","","objSysInfo.ComputerName is set to: " + objSysInfo.ComputerName
CLIENTSTATE = 99
StrERRType = StrERRType & "WRONG_Domain_"
CleanUp(99)
Else
COLLECTMSG "Sub_Check_Domain","","PC is in domain:" + sThisDomain
End If
End Sub