powershell script

Does anyone know how to pull outstanding windows updates report for all AD computers with a PowerShell script?
I don't have access to WSUS and Active directory expect for read only access.

Thanks.
A AAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

William MillerInventory/IT ConsultantCommented:
For finding out if there are pending updates:

Get-PendingUpdate -Computer DC1

Open in new window


Powershell Article on the issue:

https://blogs.technet.microsoft.com/heyscriptingguy/2012/01/20/get-windows-update-status-information-by-using-powershell/
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
A AAuthor Commented:
I need a script which lists all AD computers windows update outstanding patches.
0
A AAuthor Commented:
I want to see how many clients have over 50 outstanding patches. Your help is appreciated.

Thanks.
0
Challenges in Government Cyber Security

Has cyber security been a challenge in your government organization? Are you looking to improve your government's network security? Learn more about how to improve your government organization's security by viewing our on-demand webinar!

Jose Gabriel Ortega CastroCEOCommented:
Can you define "Outstanding patches"? Pending, applied or others?.


jose
0
A AAuthor Commented:
Pending Patches. if possible I would also like to see applied, successful and failed patches? I want to run this against all AD devices.

Thanks
0
William MillerInventory/IT ConsultantCommented:
I've also come across a very nice tool for this:

https://gallery.technet.microsoft.com/scriptcenter/Windows-Update-Utility-WUU-1d72e520

Let's you track the very things you're looking for and can do so for entire OUs in a very simple GUI.
0
Jose Gabriel Ortega CastroCEOCommented:
0
A AAuthor Commented:
WUU utility is for applying patches. I am not looking to apply any patches. All I need to see is pending updates for all active directory devices.

Jose, I am unable to run this script. does this script works for you?   how do I save this is csv file?
I am getting this error:

Get-PendingUpdate : The term 'Get-PendingUpdate' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At line:1 char:1
+ Get-PendingUpdate -ADcomputer


Can you please verify is this is correct:


Get-PendingUpdate -ADcomputer
 {
    <#    
      .SYNOPSIS  
        Retrieves the updates waiting to be installed from WSUS  
      .DESCRIPTION  
        Retrieves the updates waiting to be installed from WSUS  
      .PARAMETER Computername
        Computer or computers to find updates for.  
      .EXAMPLE  
       Get-PendingUpdates
   
       Description
       -----------
       Retrieves the updates that are available to install on the local system
      .NOTES
      Author: Boe Prox                                          
                                       
    #>
     
    #Requires -version 3.0  
    [CmdletBinding(
        DefaultParameterSetName = 'computer'
        )]
    param(
        [Parameter(ValueFromPipeline = $True)]
            [string[]$Computername = $env:COMPUTERNAME
        )    
    Process {
        ForEach ($computer in $Computername) {
            If (Test-Connection -ComputerName $computer -Count 1 -Quiet) {
                Try {
                #Create Session COM object
                    Write-Verbose "Creating COM object for WSUS Session"
                    $updatesession =  [activator]::CreateInstance([type]::GetTypeFromProgID("Microsoft.Update.Session",$computer))
                    }
                Catch {
                    Write-Warning "$($Error[0])"
                    Break
                    }
 
                #Configure Session COM Object
                Write-Verbose "Creating COM object for WSUS update Search"
                $updatesearcher = $updatesession.CreateUpdateSearcher()
 
                #Configure Searcher object to look for Updates awaiting installation
                Write-Verbose "Searching for WSUS updates on client"
                $searchresult = $updatesearcher.Search("IsInstalled=0")    
             
                #Verify if Updates need installed
                Write-Verbose "Verifing that updates are available to install"
                If ($searchresult.Updates.Count -gt 0) {
                    #Updates are waiting to be installed
                    Write-Verbose "Found $($searchresult.Updates.Count) update\s!"
                    #Cache the count to make the For loop run faster
                    $count = $searchresult.Updates.Count
                 
                    #Begin iterating through Updates available for installation
                    Write-Verbose "Iterating through list of updates"
                    For ($i=0; $i -lt $Count; $i++) {
                        #Create object holding update
                        $Update = $searchresult.Updates.Item($i)
                        [pscustomobject]@{
                            Computername = $Computer
                            Title = $Update.Title
                            KB = $($Update.KBArticleIDs)
                            SecurityBulletin = $($Update.SecurityBulletinIDs)
                            MsrcSeverity = $Update.MsrcSeverity
                            IsDownloaded = $Update.IsDownloaded
                            Url = $($Update.MoreInfoUrls)
                            Categories = ($Update.Categories | Select-Object -ExpandProperty Name)
                            BundledUpdates = @($Update.BundledUpdates)|ForEach{
                               [pscustomobject]@{
                                    Title = $_.Title
                                    DownloadUrl = @($_.DownloadContents).DownloadUrl
                                }
                            }
                        }
                    }
                }
                Else {
                    #Nothing to install at this time
                    Write-Verbose "No updates to install."
                }
            }
            Else {
+ ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-PendingUpdate:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
0
William MillerInventory/IT ConsultantCommented:
@OP: Take a look here, it seems to query all devices on an AD for pending updates. There are some pre-reqs but they're also listed in the TN Gallery:

https://gallery.technet.microsoft.com/288e8603-7073-4b2b-b369-55dc5c4eea25
0
A AAuthor Commented:
or is there any script I can from sccm to find out windows updates. can I use sccm client to find out pending updates from all AD computers. again I don't have access to wsus server. I would like to see 20+  and 50 + , pending patches in csv file.
0
Jose Gabriel Ortega CastroCEOCommented:
you save the script.
Go to an elevated powershell console.
Navegate to the path where you saved the script.
run the script
 .\Scriptname.ps1

Open in new window

And check the results.
if you obtain an output you can use this
 .\Scriptname.ps1 | Convertto-csv | out-file here.csv

Open in new window

0
A AAuthor Commented:
Thanks Jose. I will try that. I am also looking into clients not getting patches from WSUS. what could be the reason? over 500 clients are not getting patches. They are active and logging in to the system. what is stopping these machines to get patched.

Thanks.
0
A AAuthor Commented:
Hi Jose this script did not work for me.

1-please help me find the how can I get outstanding windows update for all AD computers through sccm. I don't have access to WSUS.

2-i also need help finding the Windows update agent versions for all machines in our environment. I need them both in an excel sheel.

Thank you.
0
Jose Gabriel Ortega CastroCEOCommented:
answered
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.