Deleting computers from SMS 2003 (and perhaps SCCM 2007), with a script.

Below is a script which will delete a list of computers from SMS 2003.  And quite possibly SCCM 2007 as well (not tested).  It was originally taken from the SMS 2003 Recipe Book, modified by Paul Town, and further improved by me.
The changes I made were:

  • the script will read a text file of computers to be deleted, and loop though them.
  • ping the computer to be deleted, and if it’s “pingable”, don’t delete it.
  • fixed a bug with the WMI GetObject call.

strSMSServer = "WISEFAQ2003"
strSMSSiteCode = ""

Set objFSO = CreateObject("Scripting.FileSystemObject")
If not objFSO.FileExists("C:\computer_lists\sms_deletion.txt") Then
WScript.Quit(99)
End If

Continue reading

Our SMS 2003 Server had a problem today.

And the expensive corporate system uptime management box missed the problem entirely.

The “Offersum.inbox” had over 6000 unprocessed records, and was growing at a rate of 13 records a minute.  Microsoft’s advice:

This folder receives summarization messages (.sum files) for advertisements from child sites and processes the files to the SMS site database. A backlog of files may indicate a performance problem that is caused by lots of messages. Examine status messages for the SMS Offer Status Summarizer for possible problems.

So I looked at the Status Summarizer.

Nothing.

“Nothing either”, was the result of checking the SMS log files.

“A backlog of files may indicate a performance problem” was the clue.  My offsider checked the CPU utilisation.  24% total utilisation.  This box has four processors, and there was a process using all of one CPU.

Ah ha!  We have a a culprit.

SQLagent.exe decided to go wild, and get itself stuck in a loop.  Stopping and starting the SQL Server service fixed that.  Within 20 seconds, all 6000+ records had been processed.

The utility which detected the original problem, that the expensive corporate system missed?  A 150 line PowerShell script.

Which I’ll share next week.

Bookmark and Share