Windows Update via PSWindowsUpdate
Bonjour,
J'ai mis en place un script pour le téléchargement et l'installation des mises à jour Windows sur un ordinateur distant via le module PWWindowsUpdate => https://www.powershellgallery.com/pa...Update/2.2.0.2
Le script
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| $MySession = New-PSSession -ComputerName mycomp -Credential $credentials
Invoke-Command -Session $MySession -ScriptBlock {
$param = @{
IgnoreUserInput = $true
ForceDownload = $true
Install = $true
AcceptAll = $true
AutoReboot = $true
Confirm = $false
Verbose = $true
}
Start-Sleep -Seconds 5
Import-Module PSWindowsUpdate
try
{
Get-WindowsUpdate -MicrosoftUpdate @param
}
catch
{
Write-Error $_.Exception.Message
}
} |
Et j'ai l'erreur suivante lorsque je lance le script
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| VERBOSE: mycomp (4/6/2021 2:56:16 PM): Connecting to Microsoft Update server. Please wait...
VERBOSE: Found [11] Updates in pre search criteria
VERBOSE: Found [2] Updates in post search criteria
X ComputerName Result KB Size Title PSComputerName
- ------------ ------ -- ---- ----- --------------
1 mycomp Accepted KB4481252 13MB Microsoft Silverlight (KB4481252) mycomp
1 mycomp Accepted KB2267602 545MB Mise à jour intelligente de la sécurité pour Microsoft Defender Antivirus - KB2267602 (version 1.335.325.0) mycomp
VERBOSE: Accepted [2] Updates ready to Download
Accès refusé. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException
+ PSComputerName : mycomp |
Est ce que cette erreur vous dit quelque chose ? Je précise que je lance bien le script en tant qu'admin du domaine.
Si vous disposez d'une autre solution pour lancer Windows Update en remote je suis preneur ;-)
Merci d'avance