auto decline dans wsus


/ Published in: C#
Save to your folder(s)



Copy this code and paste it in your HTML
  1. # auto-decline.ps1
  2. # Updates auto-declining script : refusing 64 bits, wmp except v11, ie except ie7, some drivers
  3. # Tested with WSUS 3.0 SP1
  4. # 22 dec 08
  5.  
  6. [System.Reflection.Assembly]::LoadWithPartialName('microsoft.updateservices.administration') | out-null
  7.  
  8. $wsusrv=[Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer()
  9.  
  10. $unneededUpdates = 0
  11.  
  12. $wsusrv.GetUpdates() |
  13. where { ($_.Isdeclined -eq $False) -and ( `
  14. ($_.Title.ToLower() -match 'ia64') `
  15. -or ($_.Title.ToLower() -match 'itanium') `
  16. -or ($_.Title.ToLower() -match 'x64') `
  17. -or ($_.Title.ToLower() -match 'internet explorer 6') `
  18. -or ($_.Title.ToLower() -match 'internet explorer 8') `
  19. -or ($_.Title.ToLower() -match 'visio') `
  20. -or ($_.Title.ToLower() -match 'onenote') `
  21. -or ($_.Title.ToLower() -match 'infopath') `
  22. -or ($_.Title.ToLower() -match 'project 2003') `
  23. -or ($_.Title.ToLower() -match 'publisher 2003') `
  24. -or ($_.Title.ToLower() -match 'nvidia') `
  25. -or ($_.Title.ToLower() -match 'ati') `
  26. -or ($_.Title.ToLower() -match 'windows media player 6.4') `
  27. -or ($_.Title.ToLower() -match 'windows media player 8') `
  28. -or ($_.Title.ToLower() -match 'windows media player 9') `
  29. -or ($_.Title.ToLower() -match 'windows media player 10') `
  30. -or ($_.IsSuperseded -eq "true") `
  31. )} |
  32. % {
  33. $_ | ft -prop Title,ArrivalDate; $_.Decline() ; $unneededUpdates += 1
  34. }
  35.  
  36. if ($unneededUpdates -gt 0)
  37. {
  38. "{0:N0} Unneeded Updates declined." -f $unneededUpdates
  39. } else
  40. {
  41. Write-warning 'No update to decline'
  42. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.