SMS Client Health Startup Script, and logging

sms2003_150x70The pilot of the SMS Client Health Startup Script has gone reasonably well.  So far the script has found about 30 broken PCs.

But the logging has been a bit hit and miss.  We write to a central log server, and we’re been getting quite a few “Path not found” errors.

Now, I think it’s either one of two things.

  1. The DNS server lying to me, and/or
  2. The section of the code which does the central log file creation.

For the lying DNS server, I’ve added a Ping of the central log server, so I’m hoping that’ll help.

Now the section of the SMS Client Health Script which checks that the log directory existed, was doing this:
If objFSO.FolderExists(LogPath) Then
Set objFolder = objFSO.GetFolder(LogPath)
Set objFolder = objFSO.CreateFolder(LogPath)
End If

"Set objFolder = objFSO.GetFolder(LogPath)" – WTF???

The script is trying to get a folder listing of ALL the log files that the central log server has.  I don’t understand why.  The code doesn’t do anything with the information.  Unless it’s some perverted way of checking that the log directory is online.

My guess is that the GetFolder call is timing out, and causing the later log file write call to fail.

So, I replaced the offending code with:
If Not objFSO.FolderExists(LogPath) Then
COLLECTMSG "Set_LOGFOLDER","ERROR","GoodLogPath not found " & err & " " & err.description
End If

We’ll see how it goes over the next week.