Forums on Intune, SCCM, and Windows 11

Welcome to the forums. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your topics and posts, as well as connect with other members through your own private inbox!

PENDING Delete deployments for software update groups

  • Thread starter Thread starter dj3094
  • Start date Start date
  • Replies Replies 2
  • Views Views 1K

dj3094

Well-Known Member
Messages
241
Reaction score
7
Points
18
Hello all,
I am trying to create a script to remove deployments for SUG older than 90 days, i started with below but I am stuck after that.
Any suggestions?
$Sugolderthan90days = Get-CMSoftwareUpdateGroup | Where-Object {$_.dateCreated -le (Get-date).AddDays(-90)} | Select-Object LocalizedDisplayName, DateCreated,Isdeployed
#$Sugolderthan90days
foreach ($Sug in $Sugolderthan90days)
{
$sugdeploy = Get-CMSoftwareUpdateDeployment -Name $sug.LocalizedDisplayName | Select-Object TargetCollectionID
$sugdeploy
#$GetSugDeployment = Get-CMDeployment -SoftwareName $sug.LocalizedDisplayName
#$GetSugDeployment

}
 
Hello all,
I am trying to create a script to remove deployments for SUG older than 90 days, i started with below but I am stuck after that.
Any suggestions?
$Sugolderthan90days = Get-CMSoftwareUpdateGroup | Where-Object {$_.dateCreated -le (Get-date).AddDays(-90)} | Select-Object LocalizedDisplayName, DateCreated,Isdeployed
#$Sugolderthan90days
foreach ($Sug in $Sugolderthan90days)
{
$sugdeploy = Get-CMSoftwareUpdateDeployment -Name $sug.LocalizedDisplayName | Select-Object TargetCollectionID
$sugdeploy
#$GetSugDeployment = Get-CMDeployment -SoftwareName $sug.LocalizedDisplayName
#$GetSugDeployment

}
What is not working with the script?
 
Back
Top