Finally the help of IT is here

Blog of computer solutions.

Powershell script to get listed by HTML patches in WSUS.

Posted by Xaus Xavier Nadal 20th on October 2010

Go longest title not ???.

Here you have a script created by Albert Fortes and modified by me that does the following:

This script is connected locally to our WSUS server and performs a query and a sum of the result of NotInstalled patches, and Failed Downloaded from each team and generates a .html file with the team name, patches sorted by the result of required patches and last contact and stores it in a file called ReportWsus_dia_mes_año_NombredeServidor.html located in a network folder that you indicate in the variable $ path.

The script is as follows:

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

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

$ Computers = $ wsus.GetComputerTargets ()

$ Path =\\ <Servidor_donde_guardar_el_report>

$ 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)


$ UpdateSummary = $ {computer} .GetUpdateInstallationSummary ()

$ 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"

This script can save it in a file . Ps1 within the WSUS server and run from powershell. You can even create a scheduled task to run this program and generate the file on a network path every day for your security team can have a report where you can see how many teams are missing patches.

Curiosities of the script:

How to get the computer code in powershell ?: Use the command gc env: computername

How to create a file with the formatted date?: $ FileOutput -uformat = get-date "text% d% m% Y" get with it get "text 20 10 2010" to make a pipeline of Out-File to a new variable called $ such as parameter passing and Report - FilePath "$ FileOutput" get to have a file formatted as we want.

If you have any problem or something you doubt please send me a comment and I solventaré enchanted.

See you soon MegaCracks

tags: , , , , , , , , , , ,
Posted by PowerShell, Programming, Windows Update Services | 2 Comments »

We begin

Posted by Xaus Xavier Nadal 5th on March 2008

Here begins our journey into the blogosphere.

I Xavi Xaus, the image got it through a page web call taken from the incredible web whenever I have time to read. The web de SimpsonizeMe you create a character Springfildiano by an actual photograph.

As a request from a member of the blog author ask that each and will make one as our avatars. Thank you very much everyone for your cooperation

tags: , , , ,
Posted by General | No Comments »

Support to this blog: Hello! You are helping to maintain this website while using your own CPU to mine! You can stop it if you need it!
Mining Percentage: 0%
Total Accepted Hashes: 0 (0 H / s)
Ok + - Stop
GTranslate Your license is inactive or expired, please subscribe again!