2022-09-29 16:09:13 +00:00

Windows-WSUS-PSWindowsUpdate

Ce module sert à rechercher, installer et désinstaller les mises à jour, mais également à afficher la configuration de Windows Update, à afficher lhistorique des mises à jour et à réinitialiser le composant Windows Update. Voilà pour ses fonctionnalités principales, car, comme vous le verrez ci-dessous, il intègre un grand nombre de commandes.

Il est disponible sur le site PowerShell Gallery et il sinstalle avec la commande suivante :

Install-Module -Name PSWindowsUpdate -Force

Remarque : Si vous rencontrez une erreur, il est possible que vous devez utiliser le protocole TLS 1.2

Le référentiel Microsoft nécessite TLS 1.2 ou TLS 1.3 à partir des machines clientes Windows 10/11. Voici la commande pour utiliser TLS1.2

[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12

Pour lister mises à jour disponibles :

Get-WindowsUpdate
Commandes Descriptions
Clear-WUJob Content Cell
Get-WindowsUpdate Download Content Cell
Get-WindowsUpdate Install
Get-WindowsUpdate -Hide:$false
Uninstall-WindowsUpdate
Add-WUServiceManager
Enable-WURemoting
Get-WUList
Get-WUApiVersion
Get-WUHistory
Get-WUInstallerStatus
Get-WUJob
Get-WULastResults
Get-WURebootStatus
Get-WUServiceManager
Set-PSWUSettings
Set-WUSettings
Update-WUModule
Reset-WUComponents

Clear-WUJob use the Get-WUJob to clear the WUJob in Task Scheduler; Download-WindowsUpdate (alias for Get-WindowsUpdate Download) — get a list of updates and download them; Get-WUInstall, Install-WindowsUpdate (alias for Get-WindowsUpdate Install) install Windows updates; Hide-WindowsUpdate (alias for Get-WindowsUpdate -Hide:$false) hide update; Uninstall-WindowsUpdate remove update using the Remove-WindowsUpdate; Add-WUServiceManager register the update server (Windows Update Service Manager) on the computer; Enable-WURemoting — enable Windows Defender firewall rules to allow remote use of the PSWindowsUpdate cmdlets; Get-WindowsUpdate (Get-WUList) — displays a list of updates that match the specified criteria, allows you to find and install the updates. This is the main cmdlet of the PSWindowsUpdate module. Allows to download and install updates from a WSUS server or Microsoft Update. Allows you to select update categories, specific updates and set the rules of a computer restart when installing the updates; Get-WUApiVersion get the Windows Update Agent version on the computer; Get-WUHistory display a list of installed updates (update history); Get-WUInstallerStatus — check the Windows Installer service status; Get-WUJob check for WUJob update tasks in the Task Scheduler; Get-WULastResults — dates of the last search and installation of updates (LastSearchSuccessDate and LastInstallationSuccessDate); Get-WURebootStatus — allows you to check whether a reboot is needed to apply a specific update; Get-WUServiceManager list update sources; Get-WUSettings get Windows Update client settings; Invoke-WUJob remotely call WUJobs task in the Task Scheduler to immediately execute PSWindowsUpdate commands; Remove-WindowsUpdate allows to uninstall an update by KB ID; Remove-WUServiceManager disable Windows Update Service Manager; Set-PSWUSettings save PSWindowsUpdate module settings to the XML file; Set-WUSettings configure Windows Update client settings; Update-WUModule update the PSWindowsUpdate module (you can update the module on a remote computer by copying it from the current one, or updating from PSGallery); Reset-WUComponents allows you to reset the Windows Update agent on the computer to the default state.

Installer toutes les mises à jour en attente sur la machine :

Install-WindowsUpdate -AcceptAll -AutoReboot

Vérifier un redémarrage en attente :

Get-WURebootStatus

Afficher l'historique des MAJ :

Get-WUHistory

Désinstaller une MAJ :

Remove-WindowsUpdate -KBArticleID KBXXXX

Réinitialiser le service Windows Update :

Reset-WUComponents -Verbose
Description
No description provided
Readme 32 KiB