SCCM - POWERSHELL - REMOVE DEPLOYMENT TO ALL TASK SEQUENCES IN FOLDER

Rate this item
(1 Vote)

Here is another script I quickly put together so that i can do a quick tidy up of our Task sequences after i moved them all into an OLD folder. Hopefully saves some time from right clicking and going through the painful process of deleting and un-deploying.

for some reason i guess due to it using the WMI Query of the host i had to do this on the actual server and not a client side.

 

 

$SiteCode = "HSC"

$FolderName = "old"

$TS = Get-WmiObject -Namespace ROOT\SMS\site_$SiteCode -Class SMS_TaskSequencePackage -Filter "ObjectPath = '/$FolderName'" | select Name

 

 

Foreach ($i in $TS)

 

{

 

 Remove-CMTaskSequenceDeployment -Name $i.name

 

}

 

Read 30427 times Last modified on November 12 2020
Login to post comments