I didn't have any problem with the brackets on Win10/PS5.1, but -AutoReboot:$false did not work. I get a prompt.
-IgnoreReboot appears to work. I need to verify on another VM.
After a reboot, when I rerun the script I get this.
Here is the script that I used. Updated on 4/3..
$LogFolder = "C:\Temp" # Where to put log files
$ts = $LogFolder + "\PatchInstallTranscript.log"
$op = $LogFolder + "\PatchInstallOutput.log"
Start-Transcript -Path $ts
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
if (-not (Get-PackageProvider -Name NuGet -ErrorAction SilentlyContinue)) {
Write-Host "NOT Installing NuGet provider..."
Install-PackageProvider -Name NuGet -Force -confirm:$false
}
else {
Write-Host "NuGet provider is already installed."
}
if (-not (Get-Module -ListAvailable -Name PSWindowsUpdate)) {
Write-Host "Installing PSWindowsUpdate module..."
Install-Module PSWindowsUpdate -Force -confirm:$false
}
else {
Write-Host "PSWindowsUpdate module is already installed."
}
Import-Module PSWindowsUpdate
Write-Host "Checking for available Windows Updates..."
Get-WindowsUpdate -verbose -IgnoreReboot
Write-Host "Installing available Windows Updates..."
$Update = Install-WindowsUpdate -AcceptAll -IgnoreReboot -verbose
if (!$Update) {
$Update = "Install-WindowsUpdate did not return any data."
}
$Update | format-table -wrap | Out-File -FilePath $op
get-content $op # record in transcript
Stop-Transcript
I would recommend that you do a reboot in case you have updates installed and waiting to to be implemented and/or other powershell.exe processes waiting for someone to type in y/n.