PS script to query WSUS

I'm new to powershell and I'm looking for a way to query our WSUS upstream server to pull down the updates that have been released by Microsoft within the last 45 days and then list the servers that do not have these updates installed yet.

Thanks,

Dean

Parents
No Data
Reply
  • What have you searched  for?
    What have you tried?

    Post your code and any errors you are getting.

    Forums like this and other will tell you that they are not free code writing services, and you need to show your effort. So, start by using your posted title and do a general web search first, try what you find in a safe environment, then post back to see if folks can help.

    It's fine to be new, but vital that you spend the time leading about PowerShell first, to limit, issue, bad habits, bad code, frustrations, misconceptions, etc.

    Lastly, never ever, run any code from any one from anywhere, that you do not fully understand and what it is / will do. If you do, you could seriously damage your host and or your enterprise. Learn to master the -WhatIf, -Confirm, and leveraging the Set-StrictMode are part of your development, put that in your profile. Learn about profiles, and how to use them. Learn about execution policies, what they are and how / when to use them. Fully leverage auditing, monitoring and logging of PowerShell use by all users and processes. Especially as part of your corporate risk management effort.

    See also the code already on the MS powershellgallery.com, which you can also get to in PowerShell using the Find-Module cmdlet.


    Book references, normally the ones you'll see most recommend:

    Beginning ---

    Learn Windows PowerShell in a Month of Lunches 3rd Edition
    Donald W. Jones   (Author),‎    Jeffrey Hicks (Author)
    ISBN-13:  978-1617294167
    ISBN-10:  1617294160


    Internediate ---

    Windows PowerShell Cookbook: The Complete Guide to Scripting Microsoft's Command Shell 3rd Edition
    Lee Holmes   (Author)
    ISBN-13:  978-1449320683
    ISBN-10:  1449320686


    Advanced ---

    Windows PowerShell in Action 3rd Edition
    by Bruce Payette (Author),‎    Richard Siddaway (Author)
    ISBN-13:  978-1633430297
    ISBN-10:  1633430294


    From Microsoft

    Windows PowerShell Survival Guide
    https://social.technet.microsoft.com/wiki/contents/articles/183.windows-powershell-survivalguide.aspx'


    See also posts here for other resource suggestions here:

    Learning this stuff.
    https://www.reddit.com/r/PowerShell/comments/bserj9/learn_powershell/eooduq9/?context=3
    https://www.reddit.com/r/PowerShell/comments/bserj9/learn_powershell/eoodxzu/?context=3

    Best Practices
    https://www.reddit.com/user/get-postanote

    Passwords
    https://www.reddit.com/r/PowerShell/comments/bv7ywa/whats_the_best_practice_for_passwords_in_ps/epoux2c/?context=3
    https://www.reddit.com/r/PowerShell/comments/c5qbjb/how_to_store_password_in_powershell_file/

    Practice with PSKoans

    PSKoans : 0.50.0
    A module designed to provide a crash-course introduction to PowerShell with programming koans.
    https://www.powershellgallery.com/packages/PSKoans/0.50.0

     Find-Module -Name '*update*' | Format-Table -AutoSize

    Version   Name                                      Repository Description                                                                                 
    -------   ----                                      ---------- -----------                                                                                 
    2.1.1.2   PSWindowsUpdate                           PSGallery  This module contain cmdlets to manage Windows Update Client.                                
    2.8.0.0   xWindowsUpdate                            PSGallery  Module with DSC Resources for Windows Update                                                
    0.2.3     Azs.Update.Admin                          PSGallery  Update Admin Client                                                                         
    1.1.0.0   UpdateServicesDsc                         PSGallery  Module with DSC Resources for deployment and configuration of Windows Server Update Services.
    3.0.147   LatestUpdate                              PSGallery  A module for retrieving the latest Windows 10 / Windows Server 2016, 2019, Semi Annual Cha...
    1.7.2     MsrcSecurityUpdates                       PSGallery  The Microsoft Security Response Center module gets Microsoft Security Update details...     
    19.7.10.0 OSDUpdate                                 PSGallery  Guides: https://www.osdeploy.com/osdupdate/guides...                                        
    1.0       UpdateInstalledModule                     PSGallery  Updates a module from the Powershell Gallery if a newer version is available. Wraps the Po...
    2.0.9.4   FlashPlayerUpdate                         PSGallery  Module description                                                                          
    1.1.0.0   UpdateServicesClientDSC                   PSGallery  DSC Resources as replacement for windows update client group policy settings. This can be ...
    1.1.34    QCT-Update-Management                     PSGallery  QCT Firmware Update Management.                                                             
    0.3       GCWindowsUpdate                           PSGallery  Manually enable, run, and disable the Windows Update process and service                    
    2.0.0     PSCoreUpdate                              PSGallery  PowerShell Core update tool                                                                 
    0.0.2     ps.checkModuleUpdates                     PSGallery  Powershell module to check and install module updates                                       
    1.0       IIT.UpdateNppPlugins                      PSGallery  Updates the Notepad++ plugins' locations after application was updated to a version 7.6.x ...
    1.0.1     psaptgetupdate                            PSGallery  This module provides functionality for PowerShellGet inspired by Linux command apt-get upd...
    1.0.11    kbupdate                                  PSGallery  KB Viewer and Saver                                                                         
    1.0       PowerShell.PowerLibrary.IncrementalUpdate PSGallery  Applies incremental updates on database                                                     
    1.1       Update-TsUser                             PSGallery  Updates a Tableau Server user (via local auth) who may have left the company. Also removes...
    0.5       Update-Lbi                                PSGallery  Powershell advanced function updates Dreamweaver library items (LBI) within html-files.     
    1.1.1.4   SQLServerUpdatesModule                    PSGallery  The module can parse information about updates with http://sqlserverupdates.com/. Next, it...
    0.1.8     WindowsOfflineUpdate                      PSGallery  Powershell module for finding, downloading and injecting updates into Windows and Windows ...
    0.2.0     UpdateManagement                          PSGallery  This module is designed to be a total revamp of the "UpdateServices" native WSUS PSModule.  
    1.2       zWindowsUpdate                            PSGallery  Search for, download and install Windows updates on local or remote computers. The module ...
    1.1.1.0   PackageUpdateInfo                         PSGallery  Module to version check all installed modules. Helps to stay up-to-date with further devel...
    1.3       cDhcpServerDynamicUpdate                  PSGallery  Class based resource to configure DHCP server dynamic updates                               
    0.3.2     WindowsUpdateSetting                      PSGallery  A set of PowerShell functions to managing Windows Update settings such as pausing, on Wind...
    0.7.6     WindowsBox.WindowsUpdates                 PSGallery  Commands to install Windows Updates on a Windows box                                        
    1.0.1     PSWinUpdate                               PSGallery  This module contains commands to both query and install Windows updates on remote Windows ...
    1.0.0.0   ProxyAddressUpdate                        PSGallery  Easily update an Active Directory Account/OU Proxy Addresses, primary, seconday and the ab...
    1.0.0.1   UPNUpdate                                 PSGallery  Easily update an Active Directory Account/OU User Principal Name (UPN)                      
    1.0.3     get-packageupdates                        PSGallery  Print updates for chocolatey and the PSGallery whenever you start a PowerShell session      
    0.0.1     CloudServerAgentUpdater                   PSGallery  This Module updates the Rackspace Cloud server agent to the latest version                  
    1.5       UpdatePwshModule                          PSGallery  This module update the powershell modules installed on your machine in two different scope...

Children
No Data