Link to home
Start Free TrialLog in
Avatar of crp0499
crp0499Flag for United States of America

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of Michael Pfister
Michael Pfister
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
So, you have never ran WSUS cleanup (Which deletes declined updates) ??
And just out of curiosity, why the need for this list ??
Avatar of crp0499

ASKER

I'll try some of these later today.
Avatar of crp0499

ASKER

That answer works perfectly.
Avatar of crp0499

ASKER

I'll award points versus having the question forced to closure.
@crp0499, The command which I suggested with Sort-Object didn't work??