PSWindowsUpdate Register a new Windows Update API Service Manager. Use Add-WUServiceManager cmdlet to register new Windows Update Service Manager. It's combination old 'Add-WUServiceManager' and 'Add-WUOfflineSync' functions to register online and offline ServiceManager Author Blog Try register Microsoft Update Service by custom ServiceID. Add-WUServiceManager -ServiceID "7971f918-a847-4430-9279-4a52d1efe18d" Confirm Are you sure you want to perform this action? Performing the operation "Register Windows Update Service Manager: 7971f918-a847-4430-9279-4a52d1efe18d" on target "MG-PC". [Y] Yes[A] Yes to All [N] No[L] No to All [S] Suspend[?] Help (default is "Y"): Y ServiceID IsManaged IsDefault Name --------- --------- --------- ---- 7971f918-a847-4430-9279-4a52d1efe18d False False Microsoft Update Try register Microsoft Update service as Service Manager. Add-WUServiceManager -MicrosoftUpdate Confirm Are you sure you want to perform this action? Performing the operation "Register Windows Update Service Manager: 7971f918-a847-4430-9279-4a52d1efe18d" on target "MG-PC". [Y] Yes[A] Yes to All [N] No[L] No to All [S] Suspend[?] Help (default is "Y"): Y ServiceID IsManaged IsDefault Name --------- --------- --------- ---- 7971f918-a847-4430-9279-4a52d1efe18d False False Microsoft Update Try register Offline Sync Service from file C:\wsusscn2.cab. Add-WUServiceManager -ScanFileLocation C:\wsusscn2.cab Confirm Are you sure you want to perform this action? Performing the operation "Register Offline Windows Update Service Manager: C:\wsusscn2.cab" on target "MG-PC". [Y] Yes[A] Yes to All [N] No[L] No to All [S] Suspend[?] Help (default is "Y"): Y ServiceID IsManaged IsDefault Name --------- --------- --------- ---- 7e1364ef-e30e-4f4e-9c66-84194eebcbbe False False Offline Sync Service Specify one or more computer names for remote connection. Specify alternative credential. Send report email to specific recipients. Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path. Required parameter for -SendReport. Passes the parameters (as hashtable) necessary to send the report: \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25];[Subject="Alternative Subject"];[Properties="Alternative object properties"];[Style="Table|List"]} Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25]}" An identifier for the service to be registered. Examples Of ServiceID: \r\n \r\n -- Windows Update 9482f4b4-e343-43b6-b170-9a65bc822c77 \r\n -- Microsoft Update 7971f918-a847-4430-9279-4a52d1efe18d \r\n -- Windows Store 117cab2d-82b1-4b5a-a08c-4d62dbee7782 \r\n -- Windows Server Update Service 3da21691-e39d-4da6-8a4b-b43877bcb1b7 A combination of AddServiceFlag values: \r\n0x1 - asfAllowPendingRegistration \r\n0x2 - asfAllowOnlineRegistration \r\n0x4 - asfRegisterServiceWithAU The path of the Microsoft signed local cabinet file (.cab) that has the information that is required for a service registration. If empty, the update agent searches for the authorization cabinet file (.cab) during service registration when a network connection is available. Register Microsoft Update Service Manager - '7971f918-a847-4430-9279-4a52d1efe18d' Name under which it will be registered Windows Update offline service. Default name is 'Offline Sync Service'. Path to Windows Update offline scan file (wsusscan.cab or wsusscn2.cab). Don't return output. Debuger return original exceptions. Begin Process End Stop Enable firewall rules for PSWindowsUpdate remoting. Use Enable-WURemoting cmdlet to enable nessesery firewall rules for PSWindowsUpdate remoting. Author Blog Enable firewall rules for PSWindowsUpdate remoting. Enable-WURemoting -Verbose Specify one or more computer names for remote connection. Specify alternative credential. Set LocalAccountTokenFilterPolicy registry entry to builds an elevated token on the target remote computer. Enable WinRM Public access from all subnets. Default access is only enabled from local subnet. Required for workgroup computers. Debuger return original exceptions. Begin Process End Stop Get list of available updates meeting the criteria. Use Get-WindowsUpdate (aka Get-WUList) cmdlet to get list of available or installed updates meeting specific criteria. Use Download-WindowsUpdate alias to get list of updates and download it. Equivalent Get-WindowsUpdate -Download. Use Install-WindowsUpdate (aka Get-WUInstall) alias to get list of updates and install it. Equivalent Get-WindowsUpdate -Install. Use Hide-WindowsUpdate alias to get list of updates and hide it. Equivalent Get-WindowsUpdate -Hide. Use Show-WindowsUpdate (aka UnHide-WindowsUpdate) alias to get list of updates and unhide it. Equivalent Get-WindowsUpdate -Hide:$false. There are two types of filtering update: Pre search criteria, Post search criteria. - Pre search works on server side, like example: (IsInstalled = 0 and IsHidden = 0 and CategoryIds contains '0fa1201d-4330-4fa8-8ae9-b877473b6441' ) - Post search work on client side after get the pre-filtered list of updates, like example $KBArticleID -match $Update.KBArticleIDs Status info list:\r\n[A|R]DIMHUB\r\nA-IsAccetped\r\nR-IsRejected\r\n D-IsDownloaded\r\n F-DownloadFailed\r\n ?-IsInvoked\r\n I-IsInstalled\r\n F-InstallFailed\r\n ?-IsInvoked\r\n R-RebootRequired\r\n M-IsMandatory\r\n H-IsHidden\r\n U-IsUninstallable\r\n B-IsBeta Author Blog Get windows updates available from default service manager. Get-WindowsUpdate -Verbose VERBOSE: MG-PC: Connecting to Windows Server Update Service server. Please wait... VERBOSE: Found[4] Updates in pre search criteria VERBOSE: Found[4] Updates in post search criteria ComputerName Status KB Size Title ------------ ------ -- ---- ----- MG-PC ------- KB890830 44MB Narzędzie Windows do usuwania złośliwego oprogramowania dla systemów Window... MG-PC ------- KB4034658 1GB 2017-08 Aktualizacja zbiorcza dla systemu Windows 10 Version 1607 dla syste... MG-PC ------- KB4034662 21MB 2017-08 Aktualizacja zabezpieczeń Adobe Flash Player w Windows 10 Version 1... MG-PC ------- KB4035631 11MB 2017-08 Aktualizacja Windows 10 Version 1607 dla systemów opartych na archi... Get all installed drivers that are available at Windows Update. Additionaly show pre search criteria. Get-WindowsUpdate -WindowsUpdate -UpdateType Driver -IsInstalled -ShowPreSearchCriteria -Verbose PreSearchCriteria: IsInstalled = 0 and Type = 'Driver' and IsHidden = 0 VERBOSE: MG-PC: Connecting to Windows Update server.Please wait... VERBOSE: Found[1] Updates in pre search criteria VERBOSE: Found[1] Updates in post search criteria ComputerName Status KB Size Title ------------ ------ -- ---- ----- MGAJDALAP3 -DI---- 3MB Intel - Other hardware - Intel(R) Watchdog Timer Driver (Intel(R) WDT) Get all available update on remote machine MG-PC, that contains in Title this two words 'Aktualizacja' and 'Windows 10' (as regular expression). Get-WindowsUpdate -ComputerName MG-PC -MicrosoftUpdate -Title "Aktualizacja.*Windows 10" -Verbose VERBOSE: MG-PC: Connecting to Microsoft Update server. Please wait... VERBOSE: Found[14] Updates in pre search criteria VERBOSE: Found[5] Updates in post search criteria ComputerName Status KB Size Title ------------ ------ -- ---- ----- MG-PC ------- KB3150513 2MB 2017-06 Aktualizacja Windows 10 Version 1607 dla systemów opartych na archi... MG-PC ------- KB4034658 1GB 2017-08 Aktualizacja zbiorcza dla systemu Windows 10 Version 1607 dla syste... MG-PC ------- KB4034662 21MB 2017-08 Aktualizacja zabezpieczeń Adobe Flash Player w Windows 10 Version 1... MG-PC ------- KB4035631 11MB 2017-08 Aktualizacja Windows 10 Version 1607 dla systemów opartych na archi... MG-PC ------- KB4033637 4MB Aktualizacja systemu Windows 10 Version 1607 dla komputerów z procesorami x... Hide update with KBArticleID: KB4034658. Get-WindowsUpdate -KBArticleID KB4034658 -Hide -Verbose or use alias Hide-WindowsUpdate -KBArticleID KB4034658 -Verbose VERBOSE: MG-PC: Connecting to Windows Server Update Service server. Please wait... VERBOSE: Found[4] Updates in pre search criteria VERBOSE: Found[1] Updates in post search criteria Confirm Are you sure you want to perform this action? Performing the operation "Hide 2017-08 Aktualizacja zbiorcza dla systemu Windows 10 Version 1607 dla systemów opartych na architekturze x64 (KB4034658)[1GB]" on target "MG-PC". [Y] Yes[A] Yes to All [N] No[L] No to All [S] Suspend[?] Help (default is "Y"): Y ComputerName Status KB Size Title ------------ ------ -- ---- ----- MG-PC ---H-- KB4034658 1GB 2017-08 Aktualizacja zbiorcza dla systemu Windows 10 Version 1607 dla syste... Unhide update with KBArticleID: KB4034658. Get-WindowsUpdate -KBArticleID KB4034658 -WithHidden -Hide:$false -Verbose or use alias Show-WindowsUpdate -KBArticleID KB4034658 -Verbose VERBOSE: MG-PC: Connecting to Windows Server Update Service server. Please wait... VERBOSE: Found[4] Updates in pre search criteria VERBOSE: Found[1] Updates in post search criteria Confirm Are you sure you want to perform this action? Performing the operation "Show 2017-08 Aktualizacja zbiorcza dla systemu Windows 10 Version 1607 dla systemów opartych na architekturze x64 (KB4034658)[1GB]" on target "MG-PC". [Y] Yes[A] Yes to All [N] No[L] No to All [S] Suspend[?] Help (default is "Y"): Y ComputerName Status KB Size Title ------------ ------ -- ---- ----- MG-PC ------ KB4034658 1GB 2017-08 Aktualizacja zbiorcza dla systemu Windows 10 Version 1607 dla syste... Schedule job at 6:00 PM to install update with UpdateId='ddb74579-7a1f-4d1f-80c8-e8647055314e' and RevisionNumber=200. Update will be automaticaly accepted and after all serwer will be automaticaly restarted if needed. Get-WindowsUpdate -MicrosoftUpdate -UpdateID ddb74579-7a1f-4d1f-80c8-e8647055314e -RevisionNumber 200 -ScheduleJob (Get-Date -Hour 18 -Minute 0 -Second 0) -Install -AcceptAll -AutoReboot -Verbose or use alias Install-WindowsUpdate -MicrosoftUpdate -UpdateID ddb74579-7a1f-4d1f-80c8-e8647055314e -RevisionNumber 200 -ScheduleJob (Get-Date -Hour 18 -Minute 0 -Second 0) -AcceptAll -AutoReboot -Verbose VERBOSE: MG-PC: Connecting to Microsoft Update server. Please wait... VERBOSE: Found[1] Updates in pre search criteria VERBOSE: Found[1] Updates in post search criteria VERBOSE: Choosed pre Search Criteria: (UpdateID = 'ddb74579-7a1f-4d1f-80c8-e8647055314e' and RevisionNumber = 200) X ComputerName Result KB Size Title - ------------ ------ -- ---- ----- 1 MG-PC Accepted KB4023307 13MB Microsoft Silverlight(KB4023307) VERBOSE: Accepted[1] Updates ready to Download VERBOSE: Invoke-WUJob: MG-PC(31.08.2017 18:00:00): VERBOSE: powershell.exe -Command "Get-WindowsUpdate -Criteria \"(UpdateID = 'ddb74579-7a1f-4d1f-80c8-e8647055314e' and RevisionNumber = 200)\" -AcceptAll -AutoReboot -Download -Install -MicrosoftUpdate -Verbose *>&1 | Out-File $Env:TEMP\PSWindowsUpdate.log" Install updates on remote computer. After all send a report from the installation process. Install-WindowsUpdate -ComputerName MG-PC -MicrosoftUpdate -AcceptAll -AutoReboot -SendReport -PSWUSettings @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";Port=25} -Verbose or use global PSWUSettings @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";Port=25} | Export-Clixml -Path 'C:\Program Files\WindowsPowerShell\Modules\PSWindowsUpdate\PSWUSettings.xml' Install-WindowsUpdate -ComputerName MG-PC -MicrosoftUpdate -AcceptAll -AutoReboot -SendReport -Verbose VERBOSE: MG-PC: Connecting to Microsoft Update server. Please wait... VERBOSE: Found[4] Updates in pre search criteria VERBOSE: Found[4] Updates in post search criteria Confirm Are you sure you want to perform this action? Performing the operation "Microsoft Silverlight (KB4023307)[13MB]" on target "MG-PC". [Y] Yes[A] Yes to All [N] No[L] No to All [S] Suspend[?] Help (default is "Y"): Y Confirm Are you sure you want to perform this action? Performing the operation "2017-06 Aktualizacja Windows 10 Version 1607 dla systemów opartych na architekturze x64 (KB3150513)[2MB]" on target "MG-PC". [Y] Yes[A] Yes to All [N] No[L] No to All [S] Suspend[?] Help (default is "Y"): Y Confirm Are you sure you want to perform this action? Performing the operation "Aktualizacja pakietu językowego usługi Microsoft Dynamics 365 2.1[47MB]" on target "MG-PC". [Y] Yes[A] Yes to All [N] No[L] No to All [S] Suspend[?] Help (default is "Y"): L X ComputerName Result KB Size Title - ------------ ------ -- ---- ----- 1 MG-PC Accepted KB4023307 13MB Microsoft Silverlight (KB4023307) 1 MG-PC Accepted KB3150513 2MB 2017-06 Aktualizacja Windows 10 Version 1607 dla systemów opartych na arc... 1 MG-PC Rejected KB4013759 47MB Aktualizacja pakietu językowego usługi Microsoft Dynamics 365 2.1 1 MG-PC Rejected KB3186568 67MB Program Microsoft .NET Framework 4.7 w syst. Windows 10 Version 1607 i Wi... VERBOSE: Accepted [2] Updates ready to Download VERBOSE: Invoke-WUJob: MG-PC (Now): VERBOSE: powershell.exe -Command "Get-WindowsUpdate -Criteria \"(UpdateID = 'ddb74579-7a1f-4d1f-80c8-e8647055314e' and RevisionNumber = 200) or (UpdateID = '151c4402-513c-4f39-8da1-f84d0956b5e3' and RevisionNumber = 200)\" -AcceptAll -Download -Install -AutoReboot -MicrosoftUpdate -SendReport -ProofOfLife -Verbose *>&1 | Out-File $Env:TEMP\PSWindowsUpdate.log" Schedule Job to install all available updates and automatically reboot system if needed. Also send report after installation (but before reboot if needed) and send second instalation history report after reboot. @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";Port=25} | Export-Clixml -Path 'C:\Program Files\WindowsPowerShell\Modules\PSWindowsUpdate\PSWUSettings.xml' Install-WindowsUpdate -MicrosoftUpdate -SendReport -SendHistory -AcceptAll -AutoReboot -ScheduleJob (Get-Date -Hour 18 -Minute 30 -Second 0) -ComputerName MG-PC -Verbose VERBOSE: MG-PC: Connecting to Microsoft Update server. Please wait... VERBOSE: Found[4] Updates in pre search criteria VERBOSE: Found[4] Updates in post search criteria X ComputerName Result KB Size Title - ------------ ------ -- ---- ----- 1 MG-PC Accepted KB3038936 5MB Aktualizacja systemu Windows 8.1 dla komputerów z procesorami x64(KB3038... 1 MG-PC Accepted KB3186606 4MB Pakiety językowe programu Microsoft.NET Framework 4.7 w syst. Windows 8.... 1 MG-PC Accepted KB4035038 53MB Sierpień 2017: wersja zapozn. pak.zb.aktual.jakości dla pr. .NET Frame... 1 MG-PC Accepted KB2267602 309MB Aktualizacja definicji dla: Windows Defender — KB2267602 (Definicja 1.251... VERBOSE: Accepted[4] Updates ready to Download VERBOSE: Invoke-WUJob: MG-PC (02.09.2017 08:30:00): VERBOSE: powershell.exe -Command "Get-WindowsUpdate -Criteria \"(UpdateID = 'e69c9679-7ce8-489a-a21c-62fb920be67a' and RevisionNumber = 201) or(UpdateID = 'de44604d-ec38-4a7f-ac63-28b3edfdb382' and RevisionNumber = 207) or(UpdateID = '9cf1d8c9-a7c3-4603-90e8-f22131ff6d7e' and RevisionNumber = 201) or(UpdateID = 'b51935f9-0e40-4624-9c26-b29bff92dcf9' and RevisionNumber = 200)\" -AcceptAll -Install -AutoReboot -MicrosoftUpdate -SendReport -SendHistory -Verbose *>&1 | Out-File $Env:TEMP\PSWindowsUpdate.log" VERBOSE: Send report Specify one or more computer names for remote connection. Interactive remote connection works only for checking updates. For download or install cmdlet creates an Invoke-WUJob task. Specify alternative credential. Send report email to specific recipients. Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file (more preferred) in ModuleBase path. Required parameter for -SendReport. Passes the parameters (as hashtable) necessary to send the report: \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25];[Subject="Alternative Subject"];[Properties="Alternative object properties"];[Style="Table|List"]} Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25]}" Send install history (Get-WUHistory) report after successful update installation or system startup. Specify time when job will start. Do not ask confirmation for updates. Download or Install all available updates. Specify number of cycles for check updates after successful update installation or system startup. First run is always main cycle (-RecurseCycle 1 or none). Second (-RecurseCycle 2) and n (-RecurseCycle n) cycle are recursive. Get list of updates and hide/unhide approved updates. Get list of updates and download approved updates, but do not install it. Forces the download of updates that are already installed or that cannot be installed. Works only with -Download. Get list of updates and install approved updates. A forced installation is an installation in which an update is installed even if the metadata indicates that the update is already installed. Before you use ForceInstall to force an installation, determine whether the update is installed and available. If an update is not installed, a forced installation fails. Works only with -Install. Do not ask for reboot if it needed. Do not ask for reboot if it needed, but do not reboot automaticaly. Specify time when system will be rebooted. Use specific Service Manager if it's available. Examples Of ServiceID: \r\n \r\n -- Windows Update 9482f4b4-e343-43b6-b170-9a65bc822c77 \r\n -- Microsoft Update 7971f918-a847-4430-9279-4a52d1efe18d \r\n -- Windows Store 117cab2d-82b1-4b5a-a08c-4d62dbee7782 \r\n -- Windows Server Update Service 3da21691-e39d-4da6-8a4b-b43877bcb1b7 Use Microsoft Update Service Manager - '7971f918-a847-4430-9279-4a52d1efe18d' Use Windows Update Service Manager - '9482f4b4-e343-43b6-b170-9a65bc822c77' Pre search criteria - native for WUAPI. Set own string that specifies the search criteria. https://docs.microsoft.com/pl-pl/windows/desktop/api/wuapi/nf-wuapi-iupdatesearcher-search Pre search criteria - native for WUAPI. Finds updates with a specific type, such as 'Driver' and 'Software'. Default value contains all updates. Pre search criteria - native for WUAPI. Finds updates that are deployed for a specific action, such as an installation or uninstallation that the administrator of a server specifies. "DeploymentAction='Installation'" finds updates that are deployed for installation on a destination computer. "DeploymentAction='Uninstallation'" depends on the other query criteria. "DeploymentAction='Uninstallation'" finds updates that are deployed for uninstallation on a destination computer. "DeploymentAction='Uninstallation'" depends on the other query criteria. If this criterion is not explicitly specified, each group of criteria that is joined to an AND operator implies "DeploymentAction='Installation'". Pre search criteria - native for WUAPI. Finds updates that are intended for deployment by Automatic Updates. "IsAssigned=1" finds updates that are intended for deployment by Automatic Updates, which depends on the other query criteria.At most, one assigned Windows-based driver update is returned for each local device on a destination computer. "IsAssigned=0" finds updates that are not intended to be deployed by Automatic Updates. Pre search criteria - native for WUAPI. When set to 1, finds updates that are present on a computer. "IsPresent=1" finds updates that are present on a destination computer.If the update is valid for one or more products, the update is considered present if it is installed for one or more of the products. "IsPresent=0" finds updates that are not installed for any product on a destination computer. Pre search criteria - native for WUAPI. "BrowseOnly=1" finds updates that are considered optional. "BrowseOnly=0" finds updates that are not considered optional. Pre search criteria - native for WUAPI. Finds updates where the AutoSelectOnWebSites property has the specified value. "AutoSelectOnWebSites=1" finds updates that are flagged to be automatically selected by Windows Update. "AutoSelectOnWebSites=0" finds updates that are not flagged for Automatic Updates. Pre search criteria - native for WUAPI. Finds updates with a specific UUID (or sets of UUIDs), such as '12345678-9abc-def0-1234-56789abcdef0'. Pre search criteria - native for WUAPI. Finds updates without a specific UUID (or sets of UUIDs), such as '12345678-9abc-def0-1234-56789abcdef0'. Pre search criteria - native for WUAPI. Finds updates with a specific RevisionNumber, such as '100'. This criterion must be combined with the UpdateID param. Pre search criteria - native for WUAPI. Finds updates that belong to a specified category (or sets of UUIDs), such as '0fa1201d-4330-4fa8-8ae9-b877473b6441'. Pre search criteria - native for WUAPI. Finds updates that are installed on the destination computer. Pre search criteria - native for WUAPI. Finds updates that are marked as hidden on the destination computer. Default search criteria is only not hidden upadates. Pre search criteria - native for WUAPI. Finds updates that are both hidden and not on the destination computer. Overwrite IsHidden param. Default search criteria is only not hidden upadates. Show choosen search criteria. Only works for pre search criteria. Post search criteria. Finds updates that contain a specified category name (or sets of categories name), such as 'Updates', 'Security Updates', 'Critical Updates', etc... Post search criteria. Finds updates that contain a KBArticleID (or sets of KBArticleIDs), such as 'KB982861'. Post search criteria. Finds updates that match part of title (case sensitive), such as '.NET Framework 4'. Post search criteria. Finds updates that match part of severity, such as 'Important', 'Critical', 'Moderate', etc... Post search criteria. Finds updates that not contain a specified category name (or sets of categories name), such as 'Updates', 'Security Updates', 'Critical Updates', etc... Post search criteria. Finds updates that not contain a KBArticleID (or sets of KBArticleIDs), such as 'KB982861'. Post search criteria. Finds updates that not match part of title (case sensitive). Post search criteria. Finds updates that not match part of severity. Post search criteria. Finds updates that the installation or uninstallation of an update can't prompt for user input. Post search criteria. Finds updates that specifies the restart behavior that not occurs when you install or uninstall the update. Install only the updates that have status AutoSelectOnWebsites on true. Post search criteria. Finds updates that have MaxDownloadSize less or equal. Size is in Bytes. Post search criteria. Finds updates that have MaxDownloadSize greater or equal. Size is in Bytes. Debuger return original exceptions. For additional debug information use $DebugPreference = "Continue" Begin Process End Stop Get list of available updates meeting the criteria. Use Get-WindowsUpdate (aka Get-WUList) cmdlet to get list of available or installed updates meeting specific criteria. Use Download-WindowsUpdate alias to get list of updates and download it. Equivalent Get-WindowsUpdate -Download. Use Install-WindowsUpdate (aka Get-WUInstall) alias to get list of updates and install it. Equivalent Get-WindowsUpdate -Install. Use Hide-WindowsUpdate alias to get list of updates and hide it. Equivalent Get-WindowsUpdate -Hide. Use Show-WindowsUpdate (aka UnHide-WindowsUpdate) alias to get list of updates and unhide it. Equivalent Get-WindowsUpdate -Hide:$false. There are two types of filtering update: Pre search criteria, Post search criteria. - Pre search works on server side, like example: (IsInstalled = 0 and IsHidden = 0 and CategoryIds contains '0fa1201d-4330-4fa8-8ae9-b877473b6441' ) - Post search work on client side after get the pre-filtered list of updates, like example $KBArticleID -match $Update.KBArticleIDs Status info list:\r\n[A|R]DIMHUB\r\nA-IsAccetped\r\nR-IsRejected\r\n D-IsDownloaded\r\n F-DownloadFailed\r\n ?-IsInvoked\r\n I-IsInstalled\r\n F-InstallFailed\r\n ?-IsInvoked\r\n R-RebootRequired\r\n M-IsMandatory\r\n H-IsHidden\r\n U-IsUninstallable\r\n B-IsBeta Author Blog Get windows updates available from default service manager. Get-WindowsUpdate -Verbose VERBOSE: MG-PC: Connecting to Windows Server Update Service server. Please wait... VERBOSE: Found[4] Updates in pre search criteria VERBOSE: Found[4] Updates in post search criteria ComputerName Status KB Size Title ------------ ------ -- ---- ----- MG-PC ------- KB890830 44MB Narzędzie Windows do usuwania złośliwego oprogramowania dla systemów Window... MG-PC ------- KB4034658 1GB 2017-08 Aktualizacja zbiorcza dla systemu Windows 10 Version 1607 dla syste... MG-PC ------- KB4034662 21MB 2017-08 Aktualizacja zabezpieczeń Adobe Flash Player w Windows 10 Version 1... MG-PC ------- KB4035631 11MB 2017-08 Aktualizacja Windows 10 Version 1607 dla systemów opartych na archi... Get all installed drivers that are available at Windows Update. Additionaly show pre search criteria. Get-WindowsUpdate -WindowsUpdate -UpdateType Driver -IsInstalled -ShowPreSearchCriteria -Verbose PreSearchCriteria: IsInstalled = 0 and Type = 'Driver' and IsHidden = 0 VERBOSE: MG-PC: Connecting to Windows Update server.Please wait... VERBOSE: Found[1] Updates in pre search criteria VERBOSE: Found[1] Updates in post search criteria ComputerName Status KB Size Title ------------ ------ -- ---- ----- MGAJDALAP3 -DI---- 3MB Intel - Other hardware - Intel(R) Watchdog Timer Driver (Intel(R) WDT) Get all available update on remote machine MG-PC, that contains in Title this two words 'Aktualizacja' and 'Windows 10' (as regular expression). Get-WindowsUpdate -ComputerName MG-PC -MicrosoftUpdate -Title "Aktualizacja.*Windows 10" -Verbose VERBOSE: MG-PC: Connecting to Microsoft Update server. Please wait... VERBOSE: Found[14] Updates in pre search criteria VERBOSE: Found[5] Updates in post search criteria ComputerName Status KB Size Title ------------ ------ -- ---- ----- MG-PC ------- KB3150513 2MB 2017-06 Aktualizacja Windows 10 Version 1607 dla systemów opartych na archi... MG-PC ------- KB4034658 1GB 2017-08 Aktualizacja zbiorcza dla systemu Windows 10 Version 1607 dla syste... MG-PC ------- KB4034662 21MB 2017-08 Aktualizacja zabezpieczeń Adobe Flash Player w Windows 10 Version 1... MG-PC ------- KB4035631 11MB 2017-08 Aktualizacja Windows 10 Version 1607 dla systemów opartych na archi... MG-PC ------- KB4033637 4MB Aktualizacja systemu Windows 10 Version 1607 dla komputerów z procesorami x... Hide update with KBArticleID: KB4034658. Get-WindowsUpdate -KBArticleID KB4034658 -Hide -Verbose or use alias Hide-WindowsUpdate -KBArticleID KB4034658 -Verbose VERBOSE: MG-PC: Connecting to Windows Server Update Service server. Please wait... VERBOSE: Found[4] Updates in pre search criteria VERBOSE: Found[1] Updates in post search criteria Confirm Are you sure you want to perform this action? Performing the operation "Hide 2017-08 Aktualizacja zbiorcza dla systemu Windows 10 Version 1607 dla systemów opartych na architekturze x64 (KB4034658)[1GB]" on target "MG-PC". [Y] Yes[A] Yes to All [N] No[L] No to All [S] Suspend[?] Help (default is "Y"): Y ComputerName Status KB Size Title ------------ ------ -- ---- ----- MG-PC ---H-- KB4034658 1GB 2017-08 Aktualizacja zbiorcza dla systemu Windows 10 Version 1607 dla syste... Unhide update with KBArticleID: KB4034658. Get-WindowsUpdate -KBArticleID KB4034658 -WithHidden -Hide:$false -Verbose or use alias Show-WindowsUpdate -KBArticleID KB4034658 -Verbose VERBOSE: MG-PC: Connecting to Windows Server Update Service server. Please wait... VERBOSE: Found[4] Updates in pre search criteria VERBOSE: Found[1] Updates in post search criteria Confirm Are you sure you want to perform this action? Performing the operation "Show 2017-08 Aktualizacja zbiorcza dla systemu Windows 10 Version 1607 dla systemów opartych na architekturze x64 (KB4034658)[1GB]" on target "MG-PC". [Y] Yes[A] Yes to All [N] No[L] No to All [S] Suspend[?] Help (default is "Y"): Y ComputerName Status KB Size Title ------------ ------ -- ---- ----- MG-PC ------ KB4034658 1GB 2017-08 Aktualizacja zbiorcza dla systemu Windows 10 Version 1607 dla syste... Schedule job at 6:00 PM to install update with UpdateId='ddb74579-7a1f-4d1f-80c8-e8647055314e' and RevisionNumber=200. Update will be automaticaly accepted and after all serwer will be automaticaly restarted if needed. Get-WindowsUpdate -MicrosoftUpdate -UpdateID ddb74579-7a1f-4d1f-80c8-e8647055314e -RevisionNumber 200 -ScheduleJob (Get-Date -Hour 18 -Minute 0 -Second 0) -Install -AcceptAll -AutoReboot -Verbose or use alias Install-WindowsUpdate -MicrosoftUpdate -UpdateID ddb74579-7a1f-4d1f-80c8-e8647055314e -RevisionNumber 200 -ScheduleJob (Get-Date -Hour 18 -Minute 0 -Second 0) -AcceptAll -AutoReboot -Verbose VERBOSE: MG-PC: Connecting to Microsoft Update server. Please wait... VERBOSE: Found[1] Updates in pre search criteria VERBOSE: Found[1] Updates in post search criteria VERBOSE: Choosed pre Search Criteria: (UpdateID = 'ddb74579-7a1f-4d1f-80c8-e8647055314e' and RevisionNumber = 200) X ComputerName Result KB Size Title - ------------ ------ -- ---- ----- 1 MG-PC Accepted KB4023307 13MB Microsoft Silverlight(KB4023307) VERBOSE: Accepted[1] Updates ready to Download VERBOSE: Invoke-WUJob: MG-PC(31.08.2017 18:00:00): VERBOSE: powershell.exe -Command "Get-WindowsUpdate -Criteria \"(UpdateID = 'ddb74579-7a1f-4d1f-80c8-e8647055314e' and RevisionNumber = 200)\" -AcceptAll -AutoReboot -Download -Install -MicrosoftUpdate -Verbose *>&1 | Out-File $Env:TEMP\PSWindowsUpdate.log" Install updates on remote computer. After all send a report from the installation process. Install-WindowsUpdate -ComputerName MG-PC -MicrosoftUpdate -AcceptAll -AutoReboot -SendReport -PSWUSettings @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";Port=25} -Verbose or use global PSWUSettings @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";Port=25} | Export-Clixml -Path 'C:\Program Files\WindowsPowerShell\Modules\PSWindowsUpdate\PSWUSettings.xml' Install-WindowsUpdate -ComputerName MG-PC -MicrosoftUpdate -AcceptAll -AutoReboot -SendReport -Verbose VERBOSE: MG-PC: Connecting to Microsoft Update server. Please wait... VERBOSE: Found[4] Updates in pre search criteria VERBOSE: Found[4] Updates in post search criteria Confirm Are you sure you want to perform this action? Performing the operation "Microsoft Silverlight (KB4023307)[13MB]" on target "MG-PC". [Y] Yes[A] Yes to All [N] No[L] No to All [S] Suspend[?] Help (default is "Y"): Y Confirm Are you sure you want to perform this action? Performing the operation "2017-06 Aktualizacja Windows 10 Version 1607 dla systemów opartych na architekturze x64 (KB3150513)[2MB]" on target "MG-PC". [Y] Yes[A] Yes to All [N] No[L] No to All [S] Suspend[?] Help (default is "Y"): Y Confirm Are you sure you want to perform this action? Performing the operation "Aktualizacja pakietu językowego usługi Microsoft Dynamics 365 2.1[47MB]" on target "MG-PC". [Y] Yes[A] Yes to All [N] No[L] No to All [S] Suspend[?] Help (default is "Y"): L X ComputerName Result KB Size Title - ------------ ------ -- ---- ----- 1 MG-PC Accepted KB4023307 13MB Microsoft Silverlight (KB4023307) 1 MG-PC Accepted KB3150513 2MB 2017-06 Aktualizacja Windows 10 Version 1607 dla systemów opartych na arc... 1 MG-PC Rejected KB4013759 47MB Aktualizacja pakietu językowego usługi Microsoft Dynamics 365 2.1 1 MG-PC Rejected KB3186568 67MB Program Microsoft .NET Framework 4.7 w syst. Windows 10 Version 1607 i Wi... VERBOSE: Accepted [2] Updates ready to Download VERBOSE: Invoke-WUJob: MG-PC (Now): VERBOSE: powershell.exe -Command "Get-WindowsUpdate -Criteria \"(UpdateID = 'ddb74579-7a1f-4d1f-80c8-e8647055314e' and RevisionNumber = 200) or (UpdateID = '151c4402-513c-4f39-8da1-f84d0956b5e3' and RevisionNumber = 200)\" -AcceptAll -Download -Install -AutoReboot -MicrosoftUpdate -SendReport -ProofOfLife -Verbose *>&1 | Out-File $Env:TEMP\PSWindowsUpdate.log" Schedule Job to install all available updates and automatically reboot system if needed. Also send report after installation (but before reboot if needed) and send second instalation history report after reboot. Set-PSWUSettings -SmtpServer smtp.office365.com -SmtpPort 587 -SmtpEnableSsl $true -SmtpSubject "PSWindowsUpdate Report" -SmtpTo mgajda@psmvp.pl -SmtpFrom mgajda@psmvp.pl -SmtpCredential (Get-Credential mgajda@psmvp.pl) Install-WindowsUpdate -MicrosoftUpdate -SendReport -SendHistory -AcceptAll -AutoReboot -ScheduleJob (Get-Date -Hour 18 -Minute 30 -Second 0) -ComputerName MG-PC -Verbose VERBOSE: MG-PC: Connecting to Microsoft Update server. Please wait... VERBOSE: Found[4] Updates in pre search criteria VERBOSE: Found[4] Updates in post search criteria X ComputerName Result KB Size Title - ------------ ------ -- ---- ----- 1 MG-PC Accepted KB3038936 5MB Aktualizacja systemu Windows 8.1 dla komputerów z procesorami x64(KB3038... 1 MG-PC Accepted KB3186606 4MB Pakiety językowe programu Microsoft.NET Framework 4.7 w syst. Windows 8.... 1 MG-PC Accepted KB4035038 53MB Sierpień 2017: wersja zapozn. pak.zb.aktual.jakości dla pr. .NET Frame... 1 MG-PC Accepted KB2267602 309MB Aktualizacja definicji dla: Windows Defender — KB2267602 (Definicja 1.251... VERBOSE: Accepted[4] Updates ready to Download VERBOSE: Invoke-WUJob: MG-PC (02.09.2017 08:30:00): VERBOSE: powershell.exe -Command "Get-WindowsUpdate -Criteria \"(UpdateID = 'e69c9679-7ce8-489a-a21c-62fb920be67a' and RevisionNumber = 201) or(UpdateID = 'de44604d-ec38-4a7f-ac63-28b3edfdb382' and RevisionNumber = 207) or(UpdateID = '9cf1d8c9-a7c3-4603-90e8-f22131ff6d7e' and RevisionNumber = 201) or(UpdateID = 'b51935f9-0e40-4624-9c26-b29bff92dcf9' and RevisionNumber = 200)\" -AcceptAll -Install -AutoReboot -MicrosoftUpdate -SendReport -SendHistory -Verbose *>&1 | Out-File $Env:TEMP\PSWindowsUpdate.log" VERBOSE: Send report Specify one or more computer names for remote connection. Interactive remote connection works only for checking updates. For download or install cmdlet creates an Invoke-WUJob task. Specify alternative credential. Send report email to specific recipients. Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file (more preferred) in ModuleBase path. Required parameter for -SendReport. Passes the parameters (as hashtable) necessary to send the report: \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25];[Subject="Alternative Subject"];[Properties="Alternative object properties"];[Style="Table|List"]} Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25]}" Send install history (Get-WUHistory) report after successful update installation or system startup. Specify time when job will start. Do not ask confirmation for updates. Download or Install all available updates. Specify number of cycles for check updates after successful update installation or system startup. First run is always main cycle (-RecurseCycle 1 or none). Second (-RecurseCycle 2) and n (-RecurseCycle n) cycle are recursive. Get list of updates and hide/unhide approved updates. Get list of updates and download approved updates, but do not install it. Forces the download of updates that are already installed or that cannot be installed. Works only with -Download. Get list of updates and install approved updates. A forced installation is an installation in which an update is installed even if the metadata indicates that the update is already installed. Before you use ForceInstall to force an installation, determine whether the update is installed and available. If an update is not installed, a forced installation fails. Works only with -Install. Do not ask for reboot if it needed. Do not ask for reboot if it needed, but do not reboot automaticaly. Specify time when system will be rebooted. Use specific Service Manager if it's available. Examples Of ServiceID: \r\n \r\n -- Windows Update 9482f4b4-e343-43b6-b170-9a65bc822c77 \r\n -- Microsoft Update 7971f918-a847-4430-9279-4a52d1efe18d \r\n -- Windows Store 117cab2d-82b1-4b5a-a08c-4d62dbee7782 \r\n -- Windows Server Update Service 3da21691-e39d-4da6-8a4b-b43877bcb1b7 Use Microsoft Update Service Manager - '7971f918-a847-4430-9279-4a52d1efe18d' Use Windows Update Service Manager - '9482f4b4-e343-43b6-b170-9a65bc822c77' Pre search criteria - native for WUAPI. Set own string that specifies the search criteria. https://docs.microsoft.com/pl-pl/windows/desktop/api/wuapi/nf-wuapi-iupdatesearcher-search Pre search criteria - native for WUAPI. Finds updates with a specific type, such as 'Driver' and 'Software'. Default value contains all updates. Pre search criteria - native for WUAPI. Finds updates that are deployed for a specific action, such as an installation or uninstallation that the administrator of a server specifies. "DeploymentAction='Installation'" finds updates that are deployed for installation on a destination computer. "DeploymentAction='Uninstallation'" depends on the other query criteria. "DeploymentAction='Uninstallation'" finds updates that are deployed for uninstallation on a destination computer. "DeploymentAction='Uninstallation'" depends on the other query criteria. If this criterion is not explicitly specified, each group of criteria that is joined to an AND operator implies "DeploymentAction='Installation'". Pre search criteria - native for WUAPI. Finds updates that are intended for deployment by Automatic Updates. "IsAssigned=1" finds updates that are intended for deployment by Automatic Updates, which depends on the other query criteria.At most, one assigned Windows-based driver update is returned for each local device on a destination computer. "IsAssigned=0" finds updates that are not intended to be deployed by Automatic Updates. Pre search criteria - native for WUAPI. When set to 1, finds updates that are present on a computer. "IsPresent=1" finds updates that are present on a destination computer.If the update is valid for one or more products, the update is considered present if it is installed for one or more of the products. "IsPresent=0" finds updates that are not installed for any product on a destination computer. Pre search criteria - native for WUAPI. "BrowseOnly=1" finds updates that are considered optional. "BrowseOnly=0" finds updates that are not considered optional. Pre search criteria - native for WUAPI. Finds updates where the AutoSelectOnWebSites property has the specified value. "AutoSelectOnWebSites=1" finds updates that are flagged to be automatically selected by Windows Update. "AutoSelectOnWebSites=0" finds updates that are not flagged for Automatic Updates. Pre search criteria - native for WUAPI. Finds updates with a specific UUID (or sets of UUIDs), such as '12345678-9abc-def0-1234-56789abcdef0'. Pre search criteria - native for WUAPI. Finds updates without a specific UUID (or sets of UUIDs), such as '12345678-9abc-def0-1234-56789abcdef0'. Pre search criteria - native for WUAPI. Finds updates with a specific RevisionNumber, such as '100'. This criterion must be combined with the UpdateID param. Pre search criteria - native for WUAPI. Finds updates that belong to a specified category (or sets of UUIDs), such as '0fa1201d-4330-4fa8-8ae9-b877473b6441'. Pre search criteria - native for WUAPI. Finds updates that are installed on the destination computer. Pre search criteria - native for WUAPI. Finds updates that are marked as hidden on the destination computer. Default search criteria is only not hidden upadates. Pre search criteria - native for WUAPI. Finds updates that are both hidden and not on the destination computer. Overwrite IsHidden param. Default search criteria is only not hidden upadates. Show choosen search criteria. Only works for pre search criteria. Post search criteria. Finds updates that contain a specified root category name 'Critical Updates', 'Definition Updates', 'Drivers', 'Feature Packs', 'Security Updates', 'Service Packs', 'Tools', 'Update Rollups', 'Updates', 'Upgrades', 'Microsoft'. Post search criteria. Finds updates that contain a specified category name (or sets of categories name), such as 'Updates', 'Security Updates', 'Critical Updates', etc... Post search criteria. Finds updates that contain a KBArticleID (or sets of KBArticleIDs), such as 'KB982861'. Post search criteria. Finds updates that match part of title (case sensitive), such as '.NET Framework 4'. Post search criteria. Finds updates that match part of severity, such as 'Important', 'Critical', 'Moderate', etc... Post search criteria. Finds updates that not contain a specified category name (or sets of categories name), such as 'Updates', 'Security Updates', 'Critical Updates', etc... Post search criteria. Finds updates that not contain a KBArticleID (or sets of KBArticleIDs), such as 'KB982861'. Post search criteria. Finds updates that not match part of title (case sensitive). Post search criteria. Finds updates that not match part of severity. Post search criteria. Finds updates that the installation or uninstallation of an update can't prompt for user input. Post search criteria. Finds updates that specifies the restart behavior that not occurs when you install or uninstall the update. Install only the updates that have status AutoSelectOnWebsites on true. Post search criteria. Finds updates that have MaxDownloadSize less or equal. Size is in Bytes. Post search criteria. Finds updates that have MaxDownloadSize greater or equal. Size is in Bytes. Debuger return original exceptions. For additional debug information use $DebugPreference = "Continue" Begin Process End Stop Get Windows Update Agent version. Use Get-WUAPIVersion cmdlet to get Windows Update Agent version. Author Blog Get Windows Update Agent version. Get-WUAPIVersion ComputerName PSWindowsUpdate ApiVersion WuapiDllVersion ------------ --------------- ---------- --------------- MG-PC 2.0 8.0 10.0.14393.1670 Specify one or more computer names for remote connection. Specify alternative credential. Send report email to specific recipients. Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path. Required parameter for -SendReport. Passes the parameters (as hashtable) necessary to send the report: \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25];[Subject="Alternative Subject"];[Properties="Alternative object properties"];[Style="Table|List"]} Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25]}" Debuger return original exceptions. Begin Process End Stop Get list of updates history. Use function Get-WUHistory to get list of installed updates on specific machine. Author Blog Get Windows Update history. Get-WUHistory ComputerName Operationname Date KB Title ------------ ------------- ---- -- ----- MG-PC Installation 30.08.2017 12:03:53 KB2267602 Definition Update for Windows Defender - KB2267602(Defini... MG-PC Installation 29.08.2017 11:49:50 KB3186568 Microsoft .NET Framework 4.7 for Windows 10 Version 1607 a... MG-PC Installation 29.08.2017 11:30:37 KB4035631 2017-08 Update for Windows Server 2016 for x64-based Syste... MG-PC Installation 29.08.2017 11:21:12 KB890830 Windows Malicious Software Removal Tool for Windows 8, 8.1... MG-PC Installation 29.08.2017 07:53:36 KB2267602 Definition Update for Windows Defender - KB2267602 (Defini... MG-PC Installation 27.08.2017 07:53:39 KB2267602 Definition Update for Windows Defender - KB2267602 (Defini... MG-PC Installation 25.08.2017 07:54:38 KB2267602 Definition Update for Windows Defender - KB2267602 (Defini... MG-PC Installation 23.08.2017 13:01:26 KB2267602 Definition Update for Windows Defender - KB2267602 (Defini... MG-PC Installation 23.08.2017 12:45:45 KB4023307 Security Update for Microsoft Silverlight (KB4023307) MG-PC Installation 23.08.2017 07:53:56 KB2267602 Definition Update for Windows Defender - KB2267602 (Defini... Get Windows Update Agent history for last 24h. Get-WUHistory -MaxDate (Get-Date).AddDays(-1) ComputerName Operationname Date KB Title ------------ ------------- ---- -- ----- MG-PC Installation 30.08.2017 12:03:53 KB2267602 Definition Update for Windows Defender - KB2267602(Defini... Specify one or more computer names for remote connection. Specify alternative credential. Send report email to specific recipients. Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path. Required parameter for -SendReport. Passes the parameters (as hashtable) necessary to send the report: @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25];[Subject="Alternative Subject"];[Properties="Alternative object properties"];[Style="Table|List"]} Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: Export-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25]}" Filter results by date. Last X history entry. Debuger return original exceptions. Begin Process End Stop Get Windows Update Installer status. Use Get-WUInstallerStatus cmdlet to show Windows Update Installer status. Author Blog Check if Windows Update Installer is busy. Get-WUInstallerStatus ComputerName IsBusy ------------ ------ MG-PC False Check if Windows Update Installer is busy in silent mode. Return only True (isBusy) or False (isFree). Get-WUInstallerStatus -Silent False Specify one or more computer names for remote connection. Specify alternative credential. Send report email to specific recipients. Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path. Required parameter for -SendReport. Passes the parameters (as hashtable) necessary to send the report: \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25];[Subject="Alternative Subject"];[Properties="Alternative object properties"];[Style="Table|List"]} Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25]}" Return true/false only. Debuger return original exceptions. Begin Process End Stop Get invoked WUJob. Use Get-WUJob cmdlet to get invoked WUJob in Task Scheduler. Author Blog Get invoked WUJob on remote machine. Get-WUJob -ComputerName MG-PC Specify one or more computer names for remote connection. Specify alternative credential. Send report email to specific recipients. Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path. Required parameter for -SendReport. Passes the parameters (as hashtable) necessary to send the report: \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25];[Subject="Alternative Subject"];[Properties="Alternative object properties"];[Style="Table|List"]} Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25]}" Specify custom name for Task Scheduler job. Default is 'PSWindowsUpdate'. Clear expired WUJob. Debuger return original exceptions. Begin Process End Stop Get Windows Update results. Use Get-WULastResults cmdlet to get Windows Update LastSearchSuccessDate and LastInstallationSuccessDate. Author Blog Get last Windows Update results. Get-WULastResults ComputerName LastSearchSuccessDate LastInstallationSuccessDate ------------ --------------------- --------------------------- MG-PC 30.08.2017 14:02:11 03.07.2017 07:35:27 Specify one or more computer names for remote connection. Specify alternative credential. Send report email to specific recipients. Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path. Required parameter for -SendReport. Passes the parameters (as hashtable) necessary to send the report: \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25];[Subject="Alternative Subject"];[Properties="Alternative object properties"];[Style="Table|List"]} Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25]}" Debuger return original exceptions. Begin Process End Stop Get offline MSU package. Use Get-WUOfflineMSU cmdlet to download MSU package from Microsoft Update Catalog website. Author Blog Download package for KB4551762. PS> Get-WUOfflineMSU -KBArticleID 4551762 -Destination C:\Temp Confirm Are you sure you want to perform this action? Performing the operation "(20.04.2020 14:27:17) 2020-03 Cumulative Update for Windows Server, version 1909 for x64-based Systems (KB4551762)[354.4 MB]" on target "DESKTOP-GCQBCBS". [Y] Yes[A] Yes to All [N] No[L] No to All [S] Suspend[?] Help (default is "Y"): N Confirm Are you sure you want to perform this action? Performing the operation "(20.04.2020 14:27:19) 2020-03 Cumulative Update for Windows 10 Version 1909 for x64-based Systems(KB4551762) [354.4 MB]" on target "DESKTOP-GCQBCBS". [Y] Yes[A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y Confirm Are you sure you want to perform this action? Performing the operation "(20.04.2020 14:27:23) 2020-03 Cumulative Update for Windows 10 Version 1903 for x64-based Systems(KB4551762) [354.4 MB]" on target "DESKTOP-GCQBCBS". [Y] Yes[A]Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): L X Result Title LastUpdated Size - ------ ----- ----------- ---- 1 Rejected 2020-03 Cumulative Update for Windows Server, version 1909 for x64-based Systems (... 3/12/2020 354.4 MB 1 Accepted 2020-03 Cumulative Update for Windows 10 Version 1909 for x64-based Systems (KB455... 3/12/2020 354.4 MB 1 Rejected 2020-03 Cumulative Update for Windows 10 Version 1903 for x64-based Systems (KB455... 3/12/2020 354.4 MB 1 Rejected 2020-03 Cumulative Update for Windows 10 Version 1909 for x86-based Systems (KB455... 3/12/2020 191.7 MB 1 Rejected 2020-03 Cumulative Update for Windows 10 Version 1903 for x86-based Systems (KB455... 3/12/2020 191.7 MB 1 Rejected 2020-03 Cumulative Update for Windows 10 Version 1909 for ARM64-based Systems (KB4... 3/12/2020 396.1 MB 1 Rejected 2020-03 Cumulative Update for Windows Server, version 1903 for x64-based Systems (... 3/12/2020 354.4 MB 1 Rejected 2020-03 Cumulative Update for Windows 10 Version 1903 for ARM64-based Systems (KB4... 3/12/2020 396.1 MB 2 Downloaded 2020-03 Cumulative Update for Windows 10 Version 1909 for x64-based Systems (KB455... 3/12/2020 354.4 MB PS> Get-ChildItem C:\Temp Directory: C:\Temp Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 12.03.2020 07:03 371656774 windows10.0-kb4551762-x64_dacef156c781f2018d94d5a5286076610ba97279.msu Specify one or more computer names for remote connection. Specify alternative credential. Send report email to specific recipients. Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path. Required parameter for -SendReport. Passes the parameters (as hashtable) necessary to send the report: \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25];[Subject="Alternative Subject"];[Properties="Alternative object properties"];[Style="Table|List"]} Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25]}" Debuger return original exceptions. Finds updates that contain a KBArticleID. Destination for downloaded files. Do not ask confirmation for download updates. Begin Process End Stop Get Windows Update reboot status. Use Get-WURebootStatus cmdlet to check if reboot is needed. Author Blog Check if restart is necessary. If yes, ask to do this or don't. Get-WURebootStatus Reboot is required. Do it now ? [Y/N] (default is 'N') ComputerName RebootRequired RebootScheduled ------------ -------------- --------------- MG-PC True Check if restart is necessary. If yes, then shedule it. Get-WURebootStatus -ScheduleReboot (Get-Date -Hour 18 -Minute 0 -Second 0) ComputerName RebootRequired RebootScheduled ------------ -------------- --------------- MG-PC True 31.08.2017 18:00:00 Specify one or more computer names for remote connection. Specify alternative credential. Send report email to specific recipients. Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path. Required parameter for -SendReport. Passes the parameters (as hashtable) necessary to send the report: \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25];[Subject="Alternative Subject"];[Properties="Alternative object properties"];[Style="Table|List"]} Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25]}" Return true/false only. Do not ask for reboot if it needed, but do it now. Specify schedule time for reboot. Cancel scheduled reboot. Debuger return original exceptions. Begin Process End Stop Get Service Manager configuration. Use Get-WUServiceManager cmdlet to get available configuration of update services. Author Blog Check currently available Windows Update Services on machine. Get-WUServiceManager ServiceID IsManaged IsDefault Name --------- --------- --------- ---- 9482f4b4-e343-43b6-b170-9a65bc822c77 False False Windows Update 7971f918-a847-4430-9279-4a52d1efe18d False False Microsoft Update 3da21691-e39d-4da6-8a4b-b43877bcb1b7 True True Windows Server Update Service 13df3d8f-78d7-4eb8-bb9c-2a101870d350 False False Offline Sync Service2 a8f3b5e6-fb1f-4814-a047-2257d39c2460 False False Offline Sync Service Specify one or more computer names for remote connection. Specify alternative credential. Send report email to specific recipients. Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path. Required parameter for -SendReport. Passes the parameters (as hashtable) necessary to send the report: \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25];[Subject="Alternative Subject"];[Properties="Alternative object properties"];[Style="Table|List"]} Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25]}" Get specific Service Manager if it's available. Debuger return original exceptions. Begin Process End Stop Get Windows Update Client settings. Use Get-WUSettings cmdlet to get current configuration of Windows Update Client. Author Blog Get current Windows Update Client configuration. Get-WUSettings ComputerName : MG-PC AcceptTrustedPublisherCerts : 0 WUServer : https://wsus.commandlinegeeks.com WUStatusServer : https://wsus.commandlinegeeks.com DetectionFrequencyEnabled : 1 DetectionFrequency : 2 NoAutoRebootWithLoggedOnUsers : 1 RebootRelaunchTimeoutEnabled : 1 RebootRelaunchTimeout : 240 IncludeRecommendedUpdates : 0 NoAutoUpdate : 0 AUOptions : 2 - Notify before download ScheduledInstallDay : 0 - Every Day ScheduledInstallTime : 4 UseWUServer : 1 Specify one or more computer names for remote connection. Specify alternative credential. Send report email to specific recipients. Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path. Required parameter for -SendReport. Passes the parameters (as hashtable) necessary to send the report: \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25];[Subject="Alternative Subject"];[Properties="Alternative object properties"];[Style="Table|List"]} Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25]}" Debuger return original exceptions. Begin Process End Stop Test cmdlet. Use Get-WUTest cmdlet to test. Author Blog Test. Get-WUTest Specify one or more computer names for remote connection. Specify alternative credential. Send report email to specific recipients. Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path. Required parameter for -SendReport. Passes the parameters (as hashtable) necessary to send the report: \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25];[Subject="Alternative Subject"];[Properties="Alternative object properties"];[Style="Table|List"]} Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25]}" Debuger return original exceptions. Test parameter. Begin Process End Stop Invoke WUJobs by Task Schduler. Use Invoke-WUJobs cmdlet to invoke PSWindowsUpdate actions remotly. It Based on TaskScheduler because CreateUpdateDownloader() and CreateUpdateInstaller() methods can't be called from a remote computer - E_ACCESSDENIED. Note: Because we do not have the ability to interact, is recommended use -AcceptAll for Install-WindowsUpdate. Author Blog Invoke Install-WindowsUpdate on remote machine today at 6:00 PM. Invoke-WUJob -ComputerName MG-PC -Script "ipmo PSWindowsUpdate; Install-WindowsUpdate -AcceptAll | Out-File C:\PSWindowsUpdate.log" -TriggerDate (Get-Date -Hour 18 -Minute 0 -Second 0) Confirm Are you sure you want to perform this action? Performing the operation "Invoke WU job: powershell.exe -Command "ipmo PSWindowsUpdate; Install-WindowsUpdate -AcceptAll | Out-File C:\PSWindowsUpdate.log"" on target "MG-PC". [Y] Yes[A] Yes to All [N] No[L] No to All [S] Suspend[?] Help (default is "Y"): Y Specify one or more computer names for remote connection. Specify alternative credential. Specify custom name for Task Scheduler job. Default is 'PSWindowsUpdate'. Specify if task must be hidden. Default is true. Specify EndBoundary for Task Scheduler trigger. Specify Time trigger for Task Scheduler job. Specify system startup trigger for Task Scheduler job. Run Task Scheduler job immediately. Specify PowerShell script that you what to run. Default is {ipmo PSWindowsUpdate; Get-WindowsUpdate -AcceptAll -Install | Out-File $Env:TEMP\PSWindowsUpdate.log} Force update old Task Scheduler Job if it's available. Debuger return original exceptions. Begin Process End Stop Download files from url using BITS. Source URL Destination path OutputType OutputType for WindowsUpdate objects. ComputerName Status KB Size Title OutputType OutputType for AgentInfo objects. ComputerName ApiVersion WuapiDll OutputType OutputType for History objects. ComputerName Operationname Date KB Title OutputType OutputType for InstallerStatus objects. ComputerName IsBusy OutputType OutputType for WUJob. ComputerName Name Action OutputType OutputType for LastResult objects. ComputerName LastSearchSuccessDate LastInstallationSuccessDate OutputType OutputType for MSU objects. Status ComputerName KB Size Title OutputType OutputType for RebootStatus objects. ComputerName RebootRequired RebootScheduled OutputType OutputType for ServiceManager objects. ComputerName Name ServiceID IsManaged IsDefaultAUService OutputType OutputType for WUSettings objects. ComputerName AcceptTrustedPublisherCerts WUServer WUStatusServer DetectionFrequencyEnabled DetectionFrequency NoAutoRebootWithLoggedOnUsers RebootRelaunchTimeoutEnabled RebootRelaunchTimeout IncludeRecommendedUpdates NoAutoUpdate AUOptions ScheduledInstallDay ScheduledInstallTime UseWUServer Impersonation of a user. Allows to execute code under another user context. Please note that the account that instantiates the Impersonator class needs to have the 'Act as part of operating system' privilege set. Initializes a new instance of the class and impersonates as a built in service account. The built in user to impersonate - either Local Service or Network Service. These users can only be impersonated by code running as System. Initializes a new instance of the class and impersonates with the specified credentials. his is the name of the user account to log on to. If you use the user principal name (UPN) format, user@DNS_domain_name, the lpszDomain parameter must be null. The name of the domain or server whose account database contains the lpszUsername account. If this parameter is null, the user name must be specified in UPN format. If this parameter is ".", the function validates the account by using only the local account database. The plaintext password for the user account. Constructor. Starts the impersonation with the given credentials. Please note that the account that instantiates the Impersonator class needs to have the 'Act as part of operating system' privilege set. The name of the user to act as. The domain name of the user to act as. The password of the user to act as. Logon Session Type Logon Provider Builtin User Destructor Specifies the type of login session used. Intended for users who are interactively using the machine, such as a user being logged on by a terminal server, remote shell, or similar process. Intended for high-performance servers to authenticate clear text passwords. LogonUser does not cache credentials for this logon type. Intended for batch servers, where processes can be executed on behalf of a user without their direct intervention; or for higher performance servers that process many clear-text authentication attempts at a time, such as mail or web servers. LogonUser does not cache credentials for this logon type. Indicates a service-type logon. The account provided must have the service privilege enabled. Indicates a proxy-type logon. This logon type is intended for GINA DLLs logging on users who are interactively using the machine. This logon type allows a unique audit record to be generated that shows when the workstation was unlocked. Preserves the name and password in the authentication packages, allowing the server to make connections to other network servers while impersonating the client. This allows a server to accept clear text credentials from a client, call LogonUser, verify that the user can access the system across the network, and still communicate with other servers. Allows the caller to clone its current token and specify new credentials for outbound connections. The new logon session has the same local identify, but uses different credentials for other network connections. Terminal Services session that is both remote and interactive. Attempt cached credentials without accessing the network. Same as RemoteInteractive. This is used for internal auditing. Workstation logon. Specifies the logon provider. Use the standard logon provider for the system. The default security provider is negotiate, unless you pass NULL for the domain name and the user name is not in UPN format. In this case, the default provider is NTLM. Use the NTLM logon provider. Use the negotiate logon provider. Specifies the impersonation level. The client is anonymous to the server. The server process can impersonate the client, but the impersonation token does not contain any information about the client. This level is only supported over the local interprocess communication transport. All other transports silently promote this level to identify. The system default level. The server can obtain the client's identity, and the server can impersonate the client to do ACL checks. The server can impersonate the client's security context while acting on behalf of the client. The server can access local resources as the client. If the server is local, it can access network resources as the client. If the server is remote, it can access only resources that are on the same computer as the server. The most powerful impersonation level. When this level is selected, the server (whether local or remote) can impersonate the client's security context while acting on behalf of the client. During impersonation, the client's credentials (both local and network) can be passed to any number of computers. Specifies the BuiltinUser type. None. Local Service. Network Service. Does the actual impersonation. The name of the user to act as. The domain name of the user to act as. The password of the user to act as. Logon Session Type Logon Provider Reverts the impersonation. Enum CredentialType The type of the credential. This member cannot be changed after the credential is created. The lack of credential type Generic credential type The credential is a generic credential. The credential will not be used by any particular authentication package. The credential will be stored securely but has no other significant characteristics. Domain password credential type The credential is a password credential and is specific to Microsoft's authentication packages. The NTLM, Kerberos, and Negotiate authentication packages will automatically use this credential when connecting to the named target. Domain certificate credential type The credential is a certificate credential and is specific to Microsoft's authentication packages. The Kerberos, Negotiate, and Schannel authentication packages automatically use this credential when connecting to the named target. Wrapper for advapi32.dll library. Advanced Services Provide access to functionality additional to the kernel. Included are things like the Windows registry, shutdown/restart the system (or abort), start/stop/create a Windows service, manage user accounts. These functions reside in advapi32.dll on 32-bit Windows. Enum PersistenceType Defines the persistence of this credential. This member can be read and written. The session persistence type The credential persists for the life of the logon session. It will not be visible to other logon sessions of this same user. It will not exist after this user logs off and back on. The local computer persistence type The credential persists for all subsequent logon sessions on this same computer. It is visible to other logon sessions of this same user on this same computer and not visible to logon sessions for this user on other computers. The enterprise persistence type The credential persists for all subsequent logon sessions on this same computer. It is visible to other logon sessions of this same user on this same computer and to logon sessions for this user on other computers. this option can be implemented as locally persisted credential if the administrator or user configures the user account to not have roam-able state. For instance, if the user has no roaming profile, the credential will only persist locally. The CredRead function reads a credential from the user's credential set. The credential set used is the one associated with the logon session of the current token. The token must not have the user's SID disabled. If the value of the Type member of the CREDENTIAL structure specified by the Credential parameter is CRED_TYPE_DOMAIN_EXTENDED, a namespace must be specified in the target name. This function can return only one credential of the specified type. Pointer to a null-terminated string that contains the name of the credential to read. Type of the credential to read. Type must be one of the CRED_TYPE_* defined types. Currently reserved and must be zero. Pointer to a single allocated block buffer to return the credential. Any pointers contained within the buffer are pointers to locations within this single allocated block. The single returned buffer must be freed by calling CredFree. The function returns TRUE on success and FALSE on failure. The CredWrite function creates a new credential or modifies an existing credential in the user's credential set. The new credential is associated with the logon session of the current token. The token must not have the user's security identifier (SID) disabled. This function creates a credential if a credential with the specified TargetName and Type does not exist. If a credential with the specified TargetName and Type exists, the new specified credential replaces the existing one. When this function writes a CRED_TYPE_CERTIFICATE credential, the Credential->CredentialBlob member specifies the PIN protecting the private key of the certificate specified by the Credential->UserName member. The credential manager does not maintain the PIN. Rather, the PIN is passed to the cryptographic service provider (CSP) indicated on the certificate for later use by the CSP and the authentication packages. The CSP defines the lifetime of the PIN. Most CSPs flush the PIN when the smart card removal from the smart card reader. If the value of the Type member of the CREDENTIAL structure specified by the Credential parameter is CRED_TYPE_DOMAIN_EXTENDED, a namespace must be specified in the target name. This function does not support writing to target names that contain wildcards. A pointer to the CREDENTIAL structure to be written. Flags that control the function's operation. The following flag is defined. If the function succeeds, the function returns TRUE, if the function fails, it returns FALSE. The CredFree function frees a buffer returned by any of the credentials management functions. Pointer to the buffer to be freed. The CredDelete function deletes a credential from the user's credential set. The credential set used is the one associated with the logon session of the current token. The token must not have the user's SID disabled. Pointer to a null-terminated string that contains the name of the credential to delete. Type of the credential to delete. Must be one of the CRED_TYPE_* defined types. For a list of the defined types, see the Type member of the CREDENTIAL structure. If the value of this parameter is CRED_TYPE_DOMAIN_EXTENDED, this function can delete a credential that specifies a user name when there are multiple credentials for the same target. The value of the TargetName parameter must specify the user name as Target|UserName. Reserved and must be zero. The function returns TRUE on success and FALSE on failure. Enumerate credentials in the credential store signature: BOOL CredEnumerate ( _In_ LPCTSTR Filter, _In_ DWORD Flags, _Out_ DWORD *Count, _Out_ PCREDENTIAL **Credentials ); [in] Pointer to a null-terminated string that contains the filter for the returned credentials.Only credentials with a TargetName matching the filter will be returned.The filter specifies a name prefix followed by an asterisk.For instance, the filter "FRED*" will return all credentials with a TargetName beginning with the string "FRED". If NULL is specified, all credentials will be returned. [in] The value of this parameter can be zero or more of the following values combined with a bitwise-OR operation. Value Meaning CRED_ENUMERATE_ALL_CREDENTIALS 0x1 This function enumerates all of the credentials in the user's credential set. The target name of each credential is returned in the "namespace:attribute=target" format. If this flag is set and the Filter parameter is not NULL, the function fails and returns ERROR_INVALID_FLAGS. Windows Server 2003 and Windows XP: This flag is not supported. [out] Count of the credentials returned in the Credentials array. [out] Pointer to an array of pointers to credentials.The returned credential is a single allocated block. Any pointers contained within the buffer are pointers to locations within this single allocated block.The single returned buffer must be freed by calling CredFree. Return value The function returns TRUE on success and FALSE on failure. The GetLastError function can be called to get a more specific status code.The following status codes can be returned. Return code/value Description ERROR_NOT_FOUND 1168 (0x490) No credential exists matching the specified Filter. ERROR_NO_SUCH_LOGON_SESSION 1312 (0x520) The logon session does not exist or there is no credential set associated with this logon session. Network logon sessions do not have an associated credential set. ERROR_INVALID_FLAGS 1004 (0x3EC) A flag that is not valid was specified for the Flags parameter, or CRED_ENUMERATE_ALL_CREDENTIALS is specified for the Flags parameter and the Filter parameter is not NULL. The CREDENTIAL structure contains an individual credential. See CREDENTIAL structure documentation. Class Credential, wrapper for native CREDENTIAL structure. See CREDENTIAL structure documentation. See Credential Manager documentation. The lock object The unmanaged code permission The credential description The disposed flag The last write time The password The persistence type The string that contains the name of the credential The credential type The username Initializes UnmanagedCodePermission for the class. Initializes a new instance of the class. Initializes a new instance of the class. The username. Initializes a new instance of the class. The username. The password. Initializes a new instance of the class. The username. The password. The string that contains the name of the credential. Initializes a new instance of the class. The username. The password. The string that contains the name of the credential. The credential type. Gets or sets the username. The user name of the account used to connect to TargetName. Gets or sets the password. The decoded secure string password. Gets or sets the secure password. The secure password of the account used to connect to TargetName. Gets or sets the target. The name of the credential. The TargetName and Type members uniquely identify the credential. This member cannot be changed after the credential is created. Instead, the credential with the old name should be deleted and the credential with the new name created. Gets or sets the description. The string comment from the user that describes this credential. This member cannot be longer than CRED_MAX_STRING_LENGTH (256) characters. Gets the last write time. The last write time. Gets the last write time UTC. The last write time UTC. Gets or sets the type. The type of the credential. This member cannot be changed after the credential is created. Gets or sets the type of the persistence. Defines the persistence of this credential. This member can be read and written. Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. Finalizes an instance of the class. Releases unmanaged and - optionally - managed resources. true to release both managed and unmanaged resources; false to release only unmanaged resources. Ensures this instance is not disposed. Credential object is already disposed. Saves this instance. true if credential is saved properly, false otherwise. password;The password has exceeded 512 bytes. Deletes this instance. true if credential was deleted properly, false otherwise. Target must be specified to delete a credential. Loads this instance. true if credential is load properly, false otherwise. Checks if the credential with these properties exists true if XXXX, false otherwise. Target must be specified to check existance of a credential. Loads all credentials Loads the internal. The credential. Loads the internal. Restart service on specific machine. Stope service on specific machine. Start service on specific machine. OutputType OutputType for credentials from Credential Manager. Username Password Domain Return Windows Update API COM object. ComputerName Status Object Error Exception Mode Return error code description. ErrorCode in Hex Short message Full Description Type of WUApiCode ValidateScheduleJobAttribute ValidateRecurseCycleAttribute ValidateTestAttribute Int must be gt 0 Universal function used in rest of PSWindowsUpdate module. Encrypt string by key. Text to encrypt Encryption key Decrypt string by key. Encrypted text Decryption key Run reboot. Computer name Schedule reboot. Computer name Computer name Cancel reboot. Computer name Check is computer is localhost or remotehost. Computer name Restart Windows Update service on specific machine. Computer name Stope service on specific machine. Computer name Service name Start service on specific machine. Computer name Service name Start service on specific machine. Name of starting file Arguments Test ping connection for specific machine. Computer name Create object ServiceManager for specific machine. Computer name Current Exception Possible http web request methods Post Get InvokeRestMethod Requested url Request method Body Headers Create object ServiceManager for specific machine. Computer name Create object ServiceManager for specific machine. Computer name Create object UpdateSession for specific machine. Computer name Create object UpdateSession for specific machine. Computer name Create object Installer for specific machine. Computer name Create object Installer for specific machine. Computer name Create object SystemInfo for specific machine. Computer name Create object SystemInfo for specific machine. Computer name Create object AutoUpdate for specific machine. Computer name Create object AutoUpdate for specific machine. Computer name Create object AgentInfo for specific machine. Computer name Create object AgentInfo for specific machine. Computer name convert size to human friendly format. Size in bytes Get PSWindowsUpdate module version on specific machine. Computer name Check PSWindowsUpdate module version on specific machine. Computer name Define minimum PSWindowsUpdate module version. Save Credentials to Credential Manager. User name Password Get credentials from Credential Manager. Get PSWindowsUpdate module path. Get GetPSWUSettings. Save GetPSWUSettings. Convert object to HTML formated table. Output object Choosed properties Send ifno about used cmdlet Format style: Table | List test email settings. Send parameters Send email report. Send parameters Output object Send ifno about used cmdlet Specifies the BuiltinUser type. Success stream. Error stream. Warning stream. Verbose stream. Debug stream. Information stream. Throw stream. Get description from error code Error code Uninstall update. Use Remove-WindowsUpdate to uninstall update. Author Blog Try to uninstall update with specific KBArticleID = KB958830. Get-WUUninstall -KBArticleID KB958830 Specify one or more computer names for remote connection. Specify alternative credential. Send report email to specific recipients. Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path. Required parameter for -SendReport. Passes the parameters (as hashtable) necessary to send the report: \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25];[Subject="Alternative Subject"];[Properties="Alternative object properties"];[Style="Table|List"]} Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25]}" Specify schedule time job. KBArticleID that will be uninstalled. Update ID that will be uninstalled. Do not ask for reboot if it needed. Do not ask for reboot if it needed, but do not reboot automaticaly. Specify time when system will be rebooted. Don't use automatic reboot. Wse wusa.exe instead of WU Api. Debuger return original exceptions. Begin Process End Stop Remove windows update service manager. Use Remove-WUServiceManager cmdlet to unregister Windows Update Service Manager. Author Blog Try unregister Microsoft Update Service. Remove-WUServiceManager -ServiceID "7971f918-a847-4430-9279-4a52d1efe18d" Confirm Are you sure you want to perform this action? Performing the operation "Unregister Windows Update Service Manager: 7971f918-a847-4430-9279-4a52d1efe18d" on target "MG-PC". [Y] Yes[A] Yes to All [N] No[L] No to All [S] Suspend[?] Help (default is "Y"): Y Specify one or more computer names for remote connection. Specify alternative credential. Send report email to specific recipients. Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path. Required parameter for -SendReport. Passes the parameters (as hashtable) necessary to send the report: \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25];[Subject="Alternative Subject"];[Properties="Alternative object properties"];[Style="Table|List"]} Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25]}" Specify schedule time job. Specify ServiceID of Service Manager that you want to remove. Debuger return original exceptions. Begin Process End Stop Reset Windows Update components. Use Reset-WUComponents cmdlet to reset all Windows Update components to default. Author Blog Reset Windows Update components to default. Reset-WUComponents -Verbose Step 1: Stop Windows Update services VERBOSE: Background Intelligent Transfer Service(BITS) VERBOSE: Windows Update(wuauserv) VERBOSE: Application Identity(appidsvc) VERBOSE: Cryptographic Services(cryptsvc) Step 2: Delete the qmgr*.dat files Step 3: Backup softare distribution folders VERBOSE: Renaming Software Distribution folder to C:\WINDOWS\SoftwareDistribution.bak5 VERBOSE: Renaming CatRoot folder to C:\WINDOWS\System32\Catroot2.bak1 Step 4: Remove old Windows Update logs VERBOSE: Deleting the C:\WINDOWS\WindowsUpdate.log files. Step 5: Reset Windows Update services VERBOSE: Reset BITS service VERBOSE: Reset Windows Update service Step 6: Reregister dll's VERBOSE: regsvr32.exe / s atl.dll VERBOSE: regsvr32.exe / s urlmon.dll VERBOSE: regsvr32.exe / s mshtml.dll VERBOSE: regsvr32.exe / s shdocvw.dll VERBOSE: regsvr32.exe / s browseui.dll VERBOSE: regsvr32.exe / s jscript.dll VERBOSE: regsvr32.exe / s vbscript.dll VERBOSE: regsvr32.exe / s scrrun.dll VERBOSE: regsvr32.exe / s msxml.dll VERBOSE: regsvr32.exe / s msxml3.dll VERBOSE: regsvr32.exe / s msxml6.dll VERBOSE: regsvr32.exe / s actxprxy.dll VERBOSE: regsvr32.exe / s softpub.dll VERBOSE: regsvr32.exe / s wintrust.dll VERBOSE: regsvr32.exe / s dssenh.dll VERBOSE: regsvr32.exe / s rsaenh.dll VERBOSE: regsvr32.exe / s gpkcsp.dll VERBOSE: regsvr32.exe / s sccbase.dll VERBOSE: regsvr32.exe / s slbcsp.dll VERBOSE: regsvr32.exe / s cryptdlg.dll VERBOSE: regsvr32.exe / s oleaut32.dll VERBOSE: regsvr32.exe / s ole32.dll VERBOSE: regsvr32.exe / s shell32.dll VERBOSE: regsvr32.exe / s initpki.dll VERBOSE: regsvr32.exe / s wuapi.dll VERBOSE: regsvr32.exe / s wuaueng.dll VERBOSE: regsvr32.exe / s wuaueng1.dll VERBOSE: regsvr32.exe / s wucltui.dll VERBOSE: regsvr32.exe / s wups.dll VERBOSE: regsvr32.exe / s wups2.dll VERBOSE: regsvr32.exe / s wuweb.dll VERBOSE: regsvr32.exe / s qmgr.dll VERBOSE: regsvr32.exe / s qmgrprxy.dll VERBOSE: regsvr32.exe / s wucltux.dll VERBOSE: regsvr32.exe / s muweb.dll VERBOSE: regsvr32.exe / s wuwebv.dll Step 7: Reset WinSock VERBOSE: netsh winsock reset Step 8: Reset Proxy VERBOSE: netsh winhttp reset proxy Step 9: Start Windows Update services VERBOSE: Cryptographic Services (cryptsvc) VERBOSE: Application Identity (appidsvc) VERBOSE: Windows Update (wuauserv) VERBOSE: Background Intelligent Transfer Service (BITS) Step 10: Start Windows Update services VERBOSE: wuauclt /resetauthorization /detectnow Specify one or more computer names for remote connection. Specify alternative credential. Send report email to specific recipients. Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path. Required parameter for -SendReport. Passes the parameters (as hashtable) necessary to send the report: \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25];[Subject="Alternative Subject"];[Properties="Alternative object properties"];[Style="Table|List"]} Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25]}" Debuger return original exceptions. Begin Process End Stop Save PSWUSettings. Use Set-PSWUSettings save PSWindowsUpdate module settings to XML file. Author Blog Set Office 365 as smtp server for PSWindowsUpdate module. Set-PSWUSettings -SmtpServer smtp.office365.com -SmtpPort 587 -SmtpEnableSsl $true -SmtpSubject "PSWindowsUpdate Report" -SmtpTo mgajda@psmvp.pl -SmtpFrom mgajda@psmvp.pl -SmtpCredential (Get-Credential mgajda@psmvp.pl) Specify one or more computer names for remote connection. Specify alternative credential. Send report email to specific recipients. Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path. Required parameter for -SendReport. Passes the parameters (as hashtable) necessary to send the report: \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25];[Subject="Alternative Subject"];[Properties="Alternative object properties"];[Style="Table|List"]} Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25]}" Save smtp server to PSWUSettings file. Save smtp port to PSWUSettings file. Save enable ssl to PSWUSettings file. Save smtp credential to Credential Manager. Save smtp recipient to PSWUSettings file. Save smtp sernder to PSWUSettings file. Save alternative message subject to PSWUSettings file. Alternative report message propertie.s Alternative report message format style. Invoke-WUJob to save credential as system user Debuger return original exceptions. Begin Process End Stop Set Windows Update Client settings. Use Set-WUSettings cmdlet to Set configuration of Windows Update Client. Author Blog Enable IncludeRecommendedUpdates attributes. Set-WUSettings -IncludeRecommendedUpdates Confirm Are you sure you want to perform this action? Performing the operation "Set Windows Update settings" on target "MG-PC". [Y] Yes[A] Yes to All [N] No[L] No to All [S] Suspend[?] Help (default is "Y"): Y ComputerName IncludeRecommendedUpdates ------------ ------------------------- MG-PC True Specify one or more computer names for remote connection. Specify alternative credential. Send report email to specific recipients. Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path. Required parameter for -SendReport. Passes the parameters (as hashtable) necessary to send the report: \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25];[Subject="Alternative Subject"];[Properties="Alternative object properties"];[Style="Table|List"]} Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25]}" Enabled - The WSUS server distributes available signed non-Microsoft updates. Disabled - The WSUS server does not distribute available signed non-Microsoft updates. Disables/Enables access to Windows Update. Enabled - All members of the Users security group can approve or disapprove updates. Disabled - Only members of the Administrators security group can approve or disapprove updates. Name of the computer group to which the computer belongs. Use/Do not use client-side targeting. HTTP(S) URL of the WSUS server that is used by Automatic Updates and API callers (by default). Notify mode: "Not configured", "Disabled", "Notify before download", "Notify before installation", "Scheduled installation", "Users configure" Silently install minor updates. Time between detection cycles. Time in hours (1–22). Enable/Disable detection frequency. Enable/Disable recommended updates. Logged-on user can decide whether to restart the client computer. Enable/Disable Automatic Updates. Time between prompts for a scheduled restart. Time in minutes (1–1440). Enable/Disable RebootRelaunchTimeout. Length, in minutes, of the restart warning countdown after updates have been installed that have a deadline or scheduled updates. Time in minutes (1–30). Enable/Disable RebootWarningTimeout. Time in minutes that Automatic Updates waits at startup before it applies updates from a missed scheduled installation time. Time in minutes (1–60). Scheduled day of install: "Every day", "Every Sunday", "Every Monday", "Every Tuesday", "Every Wednesday", "Every Thursday", ""Every Friday", "EverySaturday". Only valid if NotificationLevel (AUOptions) = "Scheduled installation" Starting with Windows 8 and Windows Server 2012, ScheduledInstallationDay are not supported and will return unreliable values.If you try to modify these properties, the operation will appear to succeed but will have no effect. Scheduled time of install in 24-hour format(0–23). Starting with Windows 8 and Windows Server 2012, ScheduledInstallTime are not supported and will return unreliable values.If you try to modify these properties, the operation will appear to succeed but will have no effect. /// The computer gets its updates from a WSUS server or from Microsoft Update. TargetReleaseVersion enable settings for controll maximum version of Feature updates. For example 1 or 0. TargetReleaseVersionInfo allow to control maximum version of Feature updates. For example "22H2". ProductVersion allow to control maximum version of Feature updates. For example "Windows 11" or "11" or "Windows 10". Debuger return original exceptions. Begin Process End Stop Update PSWindowsUpdate module. Use Use Update-WUModule cmdlet to remote update PSWindowsUpdate module. Author Blog Update PSWindowsUpdate module from PSGallery Update-WUModule -ComputerName MG-PC -Online Update PSWindowsUpdate module from current serwer. Require SMB connection to destination machine. Update-WUModule -ComputerName MG-PC -Local Specify one or more computer names for remote connection. Specify alternative credential. Send report email to specific recipients. Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path. Required parameter for -SendReport. Passes the parameters (as hashtable) necessary to send the report: \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25];[Subject="Alternative Subject"];[Properties="Alternative object properties"];[Style="Table|List"]} Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25]}" Update from PSGallery. Update from current module. Debuger return original exceptions. Begin Process End Stop