Did you get ever a situation to delete all the Packages from one Specific DP ?

There are few tools/Scripts are available

          ConfigMgr 2007 Distribution Point Package Utility

          Vbscript I like this tool as it is very quick

'Rslaten 03/2005
'http://blogs.msdn.com/b/rslaten/archive/2006/03/01/removing-a-retired-dp-from-all-your-packages.aspx
On Error Resume Next

WScript.Echo ""
WScript.Echo "SMSDPClean v1.3"
WScript.Echo "Usage: cscript.exe SMSDPClean "
WScript.Echo "Example: cscript.exe SMSDPClean.vbs myCentralSiteServer myDistributionPoint"
WScript.Echo ""

Dim SMSSiteServer, SMSNameSpace, oLocator, oServices, bDone

'Get Args, add error checking here if needed
SMSSiteServer = WScript.Arguments(0)
DP = WScript.Arguments(1)

'Get SMS namespace
SMSNameSpace = GetSMSNameSpace(SMSSiteServer)

'Connect to SMS namespace
Set oLocator = CreateObject("WbemScripting.SWbemLocator")
Set oServices = oLocator.ConnectServer(SMSSiteServer, SMSNameSpace,,,,,128)
If Err.number <> 0 Then
WScript.Echo "Error connecting to " &SMSNameSpace& " on " &SMSSiteServer& ": " &Err.Number
Set oLocator = Nothing
Set oServices = Nothing
WScript.Quit
End If

'Call main procedure
PackageLoop

'Loop until async task is done
Do While not bDone
WScript.Sleep 1000
Loop

Set oLocator = Nothing
Set oServices = Nothing
WScript.Quit


'Functions
'''''''''''''''''''''''''''''''''''''''''
'
'GetSMSNameSpace Function
'
'''''''''''''''''''''''''''''''''''''''''

Function GetSMSNameSpace(SiteServer)
On Error Resume Next
Dim
colNameSpaceQuery, refitem, refWMI
Set refWMI = GetObject("winMgmts:" &SiteServer&"rootsms")
If Err.number <> 0 Then
WScript.Echo "Error connecting to SMS namespace on " &SiteServer
WScript.Quit
End If
Set
colNameSpaceQuery = refWMI.ExecQuery("select * from SMS_ProviderLocation")
For Each refitem in colNameSpaceQuery
GetSMSNameSpace = refitem.NamespacePath
Next
Set colNameSpaceQuery = Nothing
Set refitem = Nothing
Set refWMI = Nothing
End Function

'''''''''''''''''''''''''''''''''''''''''
'
'ValidDP Function
'
'''''''''''''''''''''''''''''''''''''''''

Function ValidDP(DP, SiteCode)
On Error Resume Next
Dim
SysRes, start, finish, tempDP
ValidDP = False
Set SysRes = oServices.ExecQuery("select * from sms_sci_sysresuse where SiteCode = '" &SiteCode& "'")
For each res in SysRes
start = InStr(res.NALPath,"=") + 3
finish = InStr(res.NALPath,"]MSWNET") - 2
tempDP = mid(res.NALPath,start,finish-start)
If (UCase(tempDP) = UCase(DP)) and (res.RoleName = "SMS Distribution Point") Then
Set SysRes = Nothing
ValidDP = True
Exit Function
End If
Next

Set SysRes = Nothing
End Function

'''''''''''''''''''''''''''''''''''''''''
'
'PackageLoop SubRoutine
'
'''''''''''''''''''''''''''''''''''''''''

Sub PackageLoop
On Error Resume Next
Dim
sinkcol, retValuecol
bDone = False
Set sinkcol = wscript.CreateObject("WbemScripting.SWbemSink","SINKCOL_")
retValuecol = oServices.ExecQueryAsync(sinkcol,"SELECT * FROM SMS_DistributionPoint")
If Err.Number <> 0 Then
WScript.Echo "Error running query:" &err.description
WScript.Quit
End If
End Sub
Sub
SINKCOL_OnObjectReady(objDP, objAsyncContext)
On Error Resume Next
Dim
start, finish, tempDP
start = InStr(objDP.ServerNALPath,"=") + 3
finish = InStr(objDP.ServerNALPath,"]MSWNET") - 2
tempDP = mid(objDP.ServerNALPath,start,finish-start)
If UCase(tempDP) = UCase(DP) Then
WScript.Echo "Found " &DP& " on "& objDP.SiteCode& " linked to package " &objDP.PackageID
If ValidDP(DP, objDP.SiteCode) Then
WScript.Echo "Validated " &DP& " for site " &objDP.SiteCode
objDP.Delete_()
If Err.number <> 0 Then
WScript.Echo "Failed to delete " &DP& " from package " &objDP.PackageID& " on site " &objDP.SiteCode
WScript.Echo "Error = " &Err.number& " - " &Err.Description
Else
WScript.Echo "Successfully deleted " &DP& " from package " &objDP.PackageID& " on site " &objDP.SiteCode
End If
Else

WScript.Echo DP& " is not specified as a distribution point on site " &objDP.SiteCode
End If
End If
End Sub
Sub
SINKCOL_OnCompleted(iHResult, objErrorObject, objAsyncContext)
bDone = True
End Sub
 

Leave a Reply

Your email address will not be published. Required fields are marked *