20 April 2026

Install PowerShell 7 with automatic update

 Paste this script into administrative PowerShell prompt (version 5 is ok) and it will install newest version of PowerShell with the option to update it using Microsoft Update.

$rel = Invoke-RestMethod 'https://api.github.com/repos/PowerShell/PowerShell/releases/latest'

$url = ($rel.assets | Where-Object name -like 'PowerShell-*-win-x64.msi').browser_download_url

$file = "$env:TEMP\pwsh-latest-x64.msi"

$ProgressPreference = 'SilentlyContinue'

Invoke-WebRequest -Uri $url -OutFile $file

Start-Process msiexec.exe -Wait -ArgumentList "/i `"$file`" /quiet /norestart ADD_PATH=1 USE_MU=1 ENABLE_MU=1"

No comments:

Post a Comment