WSUS, list of declined updates, sorted by date, using powershell

Believe it or not, I've been asked to provide a list of declined updates in WSUS.  That list is HUGE.  I also need it printed.

So, I found a powershell

get-wsusupdate -approval declined

and that produced my list on the screen, so I have part of it.  Now I need it limited by date and then piped to a text file.

Can someone help?

Thanks

Cliff
crp0499CEOAsked:
Who is Participating?
 
Michael PfisterConnect With a Mentor Commented:
I'd pipe the output to Export-CSV. You can then Import it to Excel, filter/sort it to your needs and print it formatted nicely .

i.e.

get-wsusupdate -approval declined | Export-CSV C:\Temp\WSUSDeclined.csv -NoTypeInformation 

Open in new window


https://technet.microsoft.com/en-us/library/hh849932.aspx
0
 
SubsunCommented:
You can use sort to sort the dates using Sort-Object, for example, if you want to sort the CreationDate in dissenting order.
Get-wsusupdate -approval declined | Sort-Object CreationDate -Descending

Open in new window

You can also filter using Where-Object, following example gives last 3 months data..
Get-wsusupdate -approval declined | Where{$_.CreationDate -gt ((Get-Date).AddMonths(-3))} | Sort-Object CreationDate -Descending

Open in new window

result can be exported using Export-CSV
0
 
DonNetwork AdministratorCommented:
So, you have never ran WSUS cleanup (Which deletes declined updates) ??
And just out of curiosity, why the need for this list ??
0
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

 
crp0499CEOAuthor Commented:
I'll try some of these later today.
0
 
crp0499CEOAuthor Commented:
That answer works perfectly.
0
 
crp0499CEOAuthor Commented:
I'll award points versus having the question forced to closure.
0
 
SubsunCommented:
@crp0499, The command which I suggested with Sort-Object didn't work??
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.