Wednesday, December 7, 2022

20221207 PowerShell auto update

 PowerShell 7.2 enables a default auto update with Windows Update. 

To disable,

$pwshRegPath = "HKLM:\SOFTWARE\Microsoft\PowerShellCore"
if (!(Test-Path -Path $pwshRegPath)) {
    throw "PowerShell 7 is not installed"
}

Set-ItemProperty -Path $pwshRegPath -Name UseMU -Value 0 -Type DWord