Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 631
  • Last Modified:

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
0
crp0499
Asked:
crp0499
1 Solution
 
Michael PfisterCommented:
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
 
Donald StewartNetwork AdministratorCommented:
So, you have never ran WSUS cleanup (Which deletes declined updates) ??
And just out of curiosity, why the need for this list ??
0
WatchGuard Case Study: NCR

With business operations for thousands of customers largely depending on the internal systems they support, NCR can’t afford to waste time or money on security products that are anything less than exceptional. That’s why they chose WatchGuard.

 
crp0499Author Commented:
I'll try some of these later today.
0
 
crp0499Author Commented:
That answer works perfectly.
0
 
crp0499Author 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

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now