mgajda83 / pswindowsupdate Goto Github PK
View Code? Open in Web Editor NEWThis module contain cmdlets to manage Windows Update Client.
License: MIT License
This module contain cmdlets to manage Windows Update Client.
License: MIT License
Cannot use Get-WUOfflineMSU no matter what parameters I use, even if I copy exactly the example. Please see the information below as well as the screenshot
PS C:\Users\WDAGUtilityAccount> Get-WUOfflineMSU -KBArticleID "KB5031539" -Destination "C:\Temp" -Debug
DEBUG: 5/31/2024 5:37:37 PM CmdletStart: Get-WUOfflineMSU
DEBUG: 5/31/2024 5:37:38 PM http://www.catalog.update.microsoft.com/Search.aspx?q=KB5031539
VERBOSE: Found [6] Updates in Microsoft Update Catalog
DEBUG: 5/31/2024 5:37:40 PM Show update to accept: 2023-10 Servicing Stack Update for Windows 10 Version 22H2 for ARM64-based Systems (KB5031539)
DEBUG: 5/31/2024 5:37:43 PM Accepted
DEBUG: 5/31/2024 5:37:43 PM [{"uidInfo":"5365a46b-703d-476b-9263-93e956e08de8","updateID":"5365a46b-703d-476b-9263-93e956e08de8","size":0}]
Get-WUOfflineMSU : Specified argument was out of the range of valid values.
Parameter name: i
At line:1 char:1
+ CategoryInfo : NotSpecified: (:) [Get-WUOfflineMSU], ArgumentOutOfRangeException
+ FullyQualifiedErrorId : System.ArgumentOutOfRangeException,PSWindowsUpdate.GetWUOfflineMSU
I searched the repo for 'wsus' and only found reference to the wsusscn2.cab file (which I don't think is really related to using WSUS instead of the MS source for updates...
Is there a way to choose the source for the updates?
PS C:\WINDOWS\system32> import-module -name PSWindowsUpdate
import-module : Could not find a part of the path 'C:\Users\User\AppData\Local\Temp\tmpEXO_smhylu1m.qnz\exchange.format.ps1xml'.
At line:1 char:1
+ CategoryInfo : ObjectNotFound: (:String) [Import-Module], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.ImportModuleCommand
Our Powershell script operates from a central machine and cycles thru a bunch of virtual machines (Win2019, Win2022) in order to install the existing Windows updates using cmdlet "Install-WindowsUpdate".
eg.
.....
$Computer="SRV37V162"
Invoke-Command -ComputerName ($Computer) {Install-WindowsUpdate -ForceInstall -Verbose -AcceptAll}
.....
However, this results in the following error:
VERBOSE: Accepted [1] Updates ready to Download
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
+ CategoryInfo : NotSpecified: (:) [Get-WindowsUpdate], UnauthorizedAccessException
+ FullyQualifiedErrorId : System.UnauthorizedAccessException,PSWindowsUpdate.GetWindowsUpdate
+ PSComputerName : SRV37V162
The Powershell is executed with Administrator privileges.
Jochen Eckwerth
Kaufmännische Krankenkasse
Hannover
Could you add a parameter that sets the InstallAtShutdown registry key when "Reboot Required" is found?
This way we do not need to AutoReboot. We can just set the InstallAtShutdown and allow the users to have the updates automatically happen.
Hi!
I'm able to enable WU server use, but cannot understand how to clear it back.
Set-WUSettings -UseWUServer
Confirm
Are you sure you want to perform this action?
Performing the operation "(12/03/2024 19:21:48) Set Windows Update settings" on target "XXXXXXX".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y
ComputerName UseWUServer
------------ -----------
XXXXXXX True
Set-WUSettings -UseWUServer False
Set-WUSettings: A positional parameter cannot be found that accepts argument 'False'.
Set-WUSettings -UseWUServer 0
Set-WUSettings: A positional parameter cannot be found that accepts argument '0'.
Set-WUSettings -UseWUServer ''
Set-WUSettings: A positional parameter cannot be found that accepts argument ''.
Could you please advise how to use this script? Thanks!
When used with Get-WUHistory command I got the Updates History but can not exit from thet state.
PS C:\Program Files\Windows Defender> Get-WindowsUpdate -MicrosoftUpdate -Verbose -Download -AcceptAll -Install -Debug
DEBUG: 2/21/2024 2:25:33 PM CmdletStart: Get-WindowsUpdate
DEBUG: 2/21/2024 2:25:39 PM ParameterSetName: MicrosoftUpdate
DEBUG: 2/21/2024 2:25:39 PM Set pre search criteria: IsInstalled = 0
DEBUG: 2/21/2024 2:25:39 PM Set pre search criteria: IsHidden = 0
DEBUG: 2/21/2024 2:25:39 PM Search criteria is: IsInstalled = 0 and IsHidden = 0
DEBUG: 2/21/2024 2:25:39 PM CYGNUSX1: Connecting...
DEBUG: 2/21/2024 2:25:40 PM Module version: 2.2.1.4
DEBUG: 2/21/2024 2:25:40 PM Dll version: 2.2.1.4
DEBUG: 2/21/2024 2:25:40 PM UpdateSessionObj mode: Local
DEBUG: 2/21/2024 2:25:40 PM ServiceManagerObj mode: Local
DEBUG: 2/21/2024 2:25:40 PM Set source of updates to Microsof Update
DEBUG: 2/21/2024 2:25:40 PM Search for ServiceID. Set source of updates to Microsoft Update
VERBOSE: CYGNUSX1 (2/21/2024 2:25:40 PM): Connecting to Microsoft Update server. Please wait...
VERBOSE: Found [5] Updates in pre search criteria
DEBUG: 2/21/2024 2:25:51 PM Update for Microsoft Defender Antivirus antimalware platform - KB4052623 (Version 4.18.24010.12) - Current Channel (Staged)
DEBUG: 2/21/2024 2:25:51 PM Update was not filtered
DEBUG: 2/21/2024 2:25:51 PM Security Intelligence Update for Microsoft Defender Antivirus - KB2267602 (Version 1.405.391.0) - Current Channel (Broad)
DEBUG: 2/21/2024 2:25:51 PM Update was not filtered
DEBUG: 2/21/2024 2:25:51 PM Realtek - Net - 1153.13.420.2023
DEBUG: 2/21/2024 2:25:51 PM Update was not filtered
Get-WindowsUpdate : Value does not fall within the expected range.
At line:1 char:1
+ CategoryInfo : NotSpecified: (:) [Get-WindowsUpdate], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException,PSWindowsUpdate.GetWindowsUpdate
PS C:\Program Files\Windows Defender>
Before all, excellent job with this script @mgajda83 .
I've noticed there are some new driver releases on Microsoft Update Catalog (https://www.catalog.update.microsoft.com/Home.aspx) for my wireless adapter (Intel AX211 currently with driver release 22.40) but the script is not showing any of them. Is this supported?
Looking MS Update Catalog by searching for the Hardware Id of my wireless adapter I see lot of new drivers:
PS C:\windows\system32> Get-PnpDeviceProperty -InstanceId "PCI\VEN_8086&DEV_02F0&SUBSYS_00708086&REV_00\3&11583659&0&A3" | Format-Table -AutoSize
InstanceId KeyName Type Data
---------- ------- ---- ----
PCI\VEN_8086&DEV_02F0&SUBSYS_00708086&REV_00\3&11583659&0&A3 DEVPKEY_Device_DeviceDesc String Intel(R) Wi-Fi 6 AX201 160MHz
PCI\VEN_8086&DEV_02F0&SUBSYS_00708086&REV_00\3&11583659&0&A3 DEVPKEY_Device_HardwareIds StringList {**PCI\VEN_8086&DEV_02F0&SUBSYS_00708086**&REV_00, PCI\VEN_8086&DEV_02F0&SUBSYS_00708086, PCI\VEN_8086&DEV_02F0&CC_028000, PCI\VEN_8086&DEV_02F0&CC_0280}
And now entering the HiD in MS Update Catalog I get this:
Even in the case the will update look for the vendor (Lenovo in my case), adding "lenovo" to the search field shows only them. Which criterias use this PS script to search for updated drivers on MU?
I connected via SSH on my remote clients and tried to update the system. While Reading
Get-WUList
works, the installation of given update don't:
Get-WindowsUpdate -KBArticleID KB5034441 -Hide -Verbose
After questioned if I want to execute the upgrade the script fails with permission issues:
Get-WindowsUpdate : COM001: You don't have permission to perform this task.
In Zeile:1 Zeichen:1
+ Get-WindowsUpdate -KBArticleID KB5034441 -Hide -Verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-WindowsUpdate], Exception
+ FullyQualifiedErrorId : 0x80240044,PSWindowsUpdate.GetWindowsUpdate
Since the SSH Connection is estabilshed via admin-authorized keys I already thought I have elevated rights.
The command seems to accept and download email but not install or autoreboot. If I run it directly from the console it does work though:
Invoke-Command -ComputerName $Server -ScriptBlock {Install-WindowsUpdate -Install -AcceptAll -SendReport -AutoReboot -SendHistory -ScheduleJob (get-date).AddMinutes(1) }
The issue may be in the way I am attempting to run it? Perhaps I am missing something?
You did an update today? What's new? Thanks for an awesome module you have my deepest gratitude & respect!
Since several weeks I am not able anymore to install new updates. It always fails with the error: 'Object reference not set to an instance of an object'.
Does anyone know how to fix this. I have uninstalled and reinstalled PSWindowsUpdate but without success.
As an example todays full verbose output is:
VERBOSE: PC (18.05.2024 09:37:48): Connecting to Microsoft Update server. Please wait...
VERBOSE: Found [1] Updates in pre search criteria
VERBOSE: Found [1] Updates in post search criteria
Get-WindowsUpdate: Something goes wrong: Cumulative Update for Windows 11 Insider Preview (10.0.22635.3640) (KB5037867); Object reference not set to an instance of an object.
Get-WindowsUpdate: Something goes wrong: Cumulative Update for Windows 11 Insider Preview (10.0.22635.3640) (KB5037867); Object reference not set to an instance of an object.
X ComputerName Result KB Size Title
VERBOSE: Accepted [0] Updates ready to Download
VERBOSE: Downloaded [0] Updates ready to Install
VERBOSE: Installed [0] Updates
Are you willing to put up the source code for the compiled portion of this code base. It would certainly help as community members and I have often wondered about it.
Hello
Good work with this module :-)
Here is a little bug that I found.
I executed this command
get-wulist -ComputerName srv-infor-app1,int-infor-app1,dev-infor-app1 -WindowsUpdate -SendReport -PSWUSettings @{SmtpServer="smtp.xxxx.xx";From="[email protected]";To="[email protected]"} -Verbose
The updates are listed in the console
I receive the mail, but only the updates of the last server in the list are listed
My configuration :
PS C:> $psversiontable
Name Value
PSVersion 5.1.19041.3570
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.3570
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
PS C:> Get-Module PSWindowsUpdate
ModuleType Version Name ExportedCommands
Binary 2.2.1.3 PSWindowsUpdate {Add-WUServiceManager, Enable-WURemoting, Get-WindowsUpdate, Get-W...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.