Deleting Invalid SMS 2003 Distribution Points

Deleting Invalid SMS 2003 Distribution Points

If a server is decommissioned before removing SMS, orphaned Distribution Points are left in the SMS 2003 database. This becomes apparent in the SMS Administrator Console when trying to add a package to a Distribution Point, showing blank DP entries.

This post provides information on methods to cleanse the SMS database, with all methods going through the SMS provider.

Method 1 - Use the CleanDP.vbs VBScript

cscript CleanDP.vbs %server%

Method 2 - Use WMIC

Query for the distribution points for the server:

wmic /namespace:\\root\sms\site_%sitecode% /node:%server% path sms_distributionpoint WHERE "ServerNALPath like '%serverToDelete%'" get *

And then execute the delete method against the distribution point:

wmic /namespace:\\root\sms\site_%sitecode% server% path sms_distributionpoint WHERE "ServerNALPath like '%serverToDelete%'" delete

Note that the delete command can be quite powerful, use the /interactive:on global switch to prompt for each deletion.

Method 3 - Use the WMI CIM Studio

The Microsoft WMI CIM Studio application provides a GUI interface for WMI management, allowing connections to servers and paths, along with executing WQL queries and providing the possibility of deleting the result set.


' -- CleanDP.vbs
'
' Update strSiteServer and strSiteCode, and uncomment the objDP.Delete_ line
'
strSiteServer = "SERVER"
strSiteCode = "AAA"

If WScript.Arguments.UnNamed.Count = 1 Then
strServer = WScript.Arguments.UnNamed(0)
Else
WScript.Echo "Provide a server to delete all the packages from"
WScript.Quit(2)
End If

wscript.echo strserver

Set objNameSpace = GetObject("winmgmts:" & "\\" & strSiteServer & "\root\sms\site_" & strSiteCode)

strQuery = "SELECT * " & _
"FROM SMS_DistributionPoint " & _
"WHERE ServerNalPath Like '%" & strServer & "%'"

Set objDPSet = objNameSpace.ExecQuery(strQuery)
For each objDP in objDPSet
wscript.echo objDP.PackageID & ", " & objDP.SiteCode & ", " & objDP.ServerNALPath & ", " & objDP.Status
'objDP.Delete_
Next

-------------------
Enjoy,

0 comments:

Post a Comment