Finally the help of IT is here

Blog of computer solutions.

How to list approved patches and necessary equipment WSUS in Powershell

Written by Xaus Xavier Nadal on October 21st, 2010

Good,

Today in Article Powershell script to get Listed below patches in WSUS I showed you a script that makes us a list of all the patches needed for equipment and today I show a small modification by Albert Fortes in the code that manages to get this same list but approved patches.

That is, a list of patches Approved needed.

With this we get to see the patches that are missing from the equipment and we have previously approved for distribution from wsus.

[Reflection.assembly] :: LoadWithPartialName ( "Microsoft.UpdateServices.Administration")

 

$ Wsus = [Microsoft.UpdateServices.Administration.AdminProxy] :: GetUpdateServer ( "localhost", $ false);

$ Computers = $ wsus.GetComputerTargets ()

$ Path = \ \

$ Computername =gc env: computername

$ FileOutput =get-date -uformat "ReportWsus_% d_% m_% Y_ $ computername.html"

 

[Email protected]()

 

Total = $ $ Computers.Count

 

$ I = 0

 

clear host

 

foreach ($ computer in $ Computers)

{

$ UpdateScope = new-object Microsoft.UpdateServices.Administration.UpdateScope;

$ UpdateScope.UpdateApprovalActions = [Microsoft.UpdateServices.Administration.UpdateApprovalActions] :: Install `

-Bor [Microsoft.UpdateServices.Administration.UpdateApprovalActions] :: Uninstall

 

$ UpdateSummary = $ {computer}. GetUpdateInstallationSummary ($ UpdateScope)

 

$ Count = $ UpdateSummary.NotInstalledCount + $ UpdateSummary.DownloadedCount + $ UpdateSummary.FailedCount

$ Report_element = new-object psobject

$ Report_element | add-member NoteProperty "Computer" $ {computer} .FullDomainName

$ Report_element | add-member NoteProperty "NeededUpdates" $ Count

$ Report_element | add-member NoteProperty "LastUpdateSync" $ {computer} .LastSyncTime.ToString ()

$ Report + = $ Report_element

$ I = $ i + 1

$ Percent = ($ i / $ total * 100)

 

Write-Progress -Activity "WSUS query ..." `

-Status "Wait a little more." -CurrentOperation ( "Complete $ i / total $") -PercentComplete ($ i / $ Total * 100)

}

 

Clear host

 

$ Report | sort NeededUpdates | ConvertTo-Html | Out-File -FilePath "$ Path $ FileOutput"

If you have any question please make a comment and I will solventaré delighted.

See you soon MegaCracks.

Related Posts Plugin for WordPress, Blogger ...
Tags: , , , , , , , , , ,


One Response to "How to list approved patches and necessary equipment WSUS in Powershell"

  1. my Drizz Says:

    to get the KB patches that are installed as a serious thing

Leave a Reply

XHTML: You can use in Original tags: <a href="" title=""> <abbr title = ""> <acronym title = ""> <b> <blockquote cite = ""> <cite> <code> <del datetime = ""> <em> <i> <q cite = ""> <s> <strike> <strong>