I have not been able to make it into a function which I prefer but it is
very simple to follow. Careful with double-quotes during the copying,
sometimes they get changed by html.
$pkgList = 'PS1000A2'# Get-Content c:\temp\PkgNoSource1.txt | % {$pkgID =
$_ #UNCOMMENT for a list of packages
$Server = '' #sccm server name
$sitecode = '' # site code
foreach ($pkgID in $pkgList)
{
$Package = Get-Wmiobject -ComputerName $Server -NameSpace
"root\SMS\site_$sitecode" -Query "Select * FROM SMS_DistributionPoint Where
packageID = '$pkgID' AND ServerNALPath LIKE '%'" # specify name of DP here
if needed.
$Package
If ($Package -ne $null)
{$Package.PackageID; $Package.Delete()}
else
{$Package.PackageID}
}
###### UNCOMMENT WHEN REMOVING PACKAGES BY USING GROUP OF DPs ######
#foreach ($pkgID in $pkgList)
# { $DistributionPointGroup = "%" #specify group name for cm12
# $DPGroupQuery = Get-WmiObject -ComputerName $Server -Namespace
"Root\SMS\Site_$sitecode" -Query "Select * FROM SMS_DistributionPointGroup
Where Name Like '$DistributionPointGroup'"
# $DPGroupQuery
# $DPGroupQuery.RemovePackages($pkgID)
# }
#} UNCOMMENT when using a list of packages
On Fri, Dec 27, 2013 at 10:37 AM, elsalvoz <[email protected]> wrote:
> I have one that I've been using that takes a package ID or list. I will
> post it when I get home. It is for CM12 but should be unable in a CM07
> environment. Test it first though.
> On Dec 27, 2013 10:24 AM, "Rajkumar Bhoopathy" <
> [email protected]> wrote:
>
>> Hello Community Members,
>>
>> I've some numbers of messed up Distribution Points which are really with
>> weird packages installation status. I'm to remove the selected packages
>> from those DP's and redistribute it. I searched in google for a script
>> (powershell or vbscript). There are good scripts available but im planning
>> to remove those packages from a selected Distribution point (i.e., Remote
>> DP's.). Its all SCCM 2007 DP's.
>>
>> Can someone please help me with the script if already available, i will
>> utilize that. Also if script available to distribute the packages to Remote
>> DP's would be fine and greatly appreciated.
>>
>> Regards / Raj.
>>
>>
>