powershell updates is the process of upgrading PowerShell 7.x to the newest stable or LTS version using package managers, MSI installers, or .NET global tools.
winget install --id Microsoft.Powershell --source winget
Tested on Ubuntu 22.04 with Linux 5.15.x; verify against vendor docs for non-Debian distributions or older kernels.
Syntax
Update methods vary by platform and installation type. Below are the primary syntax forms.
# Windows – winget (recommended)
winget install --id Microsoft.Powershell --source winget [--exact]
# Windows – MSI with command-line options
msiexec.exe /package PowerShell-7.7.0-win-x64.msi /quiet ADD_PATH=1 ENABLE_PSREMOTING=1
# Linux – apt (Ubuntu/Debian)
sudo apt-get update && sudo apt-get install -y powershell
# macOS – brew
brew upgrade powershell
# Cross-platform – .NET Global tool
dotnet tool update --global PowerShell
Options and Flags
| Flag / Option | Type | Default | Description |
|---|---|---|---|
--id |
string | N/A | Package identifier for winget (e.g., Microsoft.Powershell). |
--source |
string | winget | Source repository (winget, msstore). Required for winget. |
--exact |
switch | false | Match the version exactly (used with --version). |
--installer-type |
string | N/A | For MSI: msi or appx. Valid for winget install. |
ADD_PATH |
MSI property | 1 | Adds PowerShell to PATH environment variable. |
ENABLE_PSREMOTING |
MSI property | 1 | Enables PowerShell remoting during installation. |
--global |
switch | false | Install .NET global tool for all users (requires admin). |
Usage Examples
Example 1: Update to latest stable version using winget (Windows)
winget install --id Microsoft.Powershell --source winget --exact
This fetches the latest stable release from the winget repository. The --exact flag ensures the version exactly matches the published manifest; useful for scripting deterministic updates.
Example 2: Silent MSI update with telemetry disabled
msiexec.exe /package PowerShell-7.7.0-win-x64.msi /quiet /norestart ADD_PATH=1 DISABLE_TELEMETRY=1 USE_MU=1
Installs PowerShell 7.7.0 silently, disables telemetry (DISABLE_TELEMETRY=1), and opts into Microsoft Update (USE_MU=1) for future automatic updates. Requires admin rights.
Example 3: Update via .NET Global tool on Linux/macOS
dotnet tool update --global PowerShell
Updates the .NET global tool PowerShell installation. Requires the .NET SDK (version 8.0+) to be already installed. The updated binary is placed under $HOME/.dotnet/tools.
Troubleshooting & Common Errors
| Error Message / Code | Root Cause | Resolution Command |
|---|---|---|
| winget: ‘winget’ is not recognized | Winget not installed or not in PATH. |
|
| Failed to install because the package version is not found | Specified version doesn’t exist in winget source. |
|
| Access denied (0x5) when running MSI | Insufficient privileges. Run as Administrator. |
|
| PowerShell 7.7.0 not found in apt repository | Package repository index outdated. |
|
| dotnet tool update fails: The tool ‘powershell’ is not installed globally | PowerShell was not installed as a .NET global tool. |
|
Performance Considerations and Tuning
Performance of updating PowerShell depends largely on network throughput, download size, and the update mechanism selected. When using the official MSI installer or the winget CLI, the following knobs and commands can reduce update latency and avoid failures.
- Update source: Using
--source winget(or--source msstore) together with--id Microsoft.Powershelltargets a specific package and minimizes metadata lookup. Adding--exacteliminates version-range resolution overhead. - Microsoft Update integration: The flag
USE_MU(enabled via installer) orENABLE_MUdirects PowerShell to receive updates through Windows Update, which uses delta-compression and enterprise‑grade delivery infrastructure. This can significantly reduce download size compared to full MSI re‑downloads. - Batch updates (Linux): On Ubuntu/Debian,
apt-get install --only-upgrade -y powershellskips dependency re‑evaluation and answers prompts automatically, speeding headless deployment. - Network-level tuning: For large MSI packages (50+ MB), adjusting the TCP receive window and disabling Nagle’s algorithm via
net.ipv4.tcp_sack(Linux) ornetsh interface tcp set global autotuninglevel=normal(Windows) improves throughput. The Windows TCP/IP technical reference documents these settings.
When upgrading many systems simultaneously, consider staggering parallel invocations to avoid saturating a proxy or WAN link. Use the --upgrade-available flag only when you need to check; skip it for deterministic bulk installs.
# Fast, exact update via winget (no version search)
winget install --id Microsoft.Powershell --source winget --exact
# Linux headless update with minimal overhead
sudo apt-get install --only-upgrade -y powershell
Security and Operational Best Practices
Regularly updating PowerShell is critical for security. Follow these practices to minimize risk and maintain auditability.
- IAM/Least-Privilege: Do not run PowerShell update installers as a domain admin or root. On Windows, use a standard user account with local administrator rights only for installation. On Linux, use
sudowith a dedicated service account. - Authentication Knobs: For remoting, enforce certificate-based authentication and disable Basic authentication. On Windows, set
WinRMto require HTTPS and signed script execution (Set-ExecutionPolicy RemoteSigned). Opt out of telemetry by setting environment variablePOWERSHELL_TELEMETRY_OPTOUT=1(equivalent to MSI flagDISABLE_TELEMETRY). - Audit & Logging Hooks: Enable PowerShell script block logging (
Event ID 4104) via Group Policy. For Linux, useauditdto trackpowershellbinary execution. Capture all command history withGet-WinEventfor Windows, orjournalctlon Linux.
Real audit and update commands:
# Update PowerShell on Ubuntu 18.04 using apt-get
sudo apt-get install --only-upgrade -y powershell
# Verify installed version
powershell -Command '$PSVersionTable.PSVersion'
# Audit PowerShell script execution (Windows)
Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-PowerShell/Operational'; ID=4104} | Format-Table TimeCreated, Message
# Audit PowerShell activity on Linux (requires auditd)
sudo auditctl -w /opt/microsoft/powershell/7/pwsh -p wa -k powershell_exec
sudo ausearch -k powershell_exec --interpret
Always test updates in a staging environment and verify Windows Event IDs (e.g., 4103 for pipeline execution) and Linux journal entries for suspicious activity.
Cross-Platform Update Methods
PowerShell updates are not cloud-specific; the table shows cross-platform equivalents.
| Platform | Method | Equivalent CLI |
|---|---|---|
| Windows | winget | winget upgrade Microsoft.Powershell |
| Windows | MSI | msiexec /i PowerShell-7.7.0-win-x64.msi |
| Linux (apt) | apt-get | sudo apt-get update && sudo apt-get install -y powershell |
| macOS | Homebrew | brew upgrade powershell |
| Cross-platform | .NET Global tool | dotnet tool update --global PowerShell |
Frequently Asked Questions
What is the difference between Update-Module and Install-Module -Force?
Answer: Update-Module upgrades an installed module to the latest version; Install-Module -Force replaces the module even if same version exists.
Update-Module only updates if a newer version is available and preserves existing versions. Install-Module -Force overwrites regardless of version, useful for re-registration. Use Update-Module for routine updates; use -Force to fix corruption or reinstall.
Update-Module -Name Az -Force
Install-Module -Name Az -Force
When should I use the -Scope CurrentUser flag with Update-Module?
Answer: Use -Scope CurrentUser when you lack admin rights or need per‑user isolation for module version control in non‑administrative contexts.
By default, Update-Module targets AllUsers (requires elevation). -Scope CurrentUser installs to $HOMEDocumentsPowerShellModules. Essential in CI/CD agents or cloud shells where admin isn’t available.
Update-Module -Name Pester -Scope CurrentUser
How do I fix “No match was found for the specified search criteria” when running Update-Module?
Answer: Register the PSGallery repository explicitly: Register-PSRepository -Default then retry with Update-Module -Name -ErrorAction Stop.
This error indicates the repository is missing or unreachable. Check repository status with Get-PSRepository. Force re‑registration clears cached failures.
Get-PSRepository
Register-PSRepository -Default -ErrorAction SilentlyContinue
Update-Module -Name Az -ErrorAction Stop
Does Update-Module work on Linux or macOS in PowerShell 7+?
Answer: Yes, PowerShell 7+ includes Update-Module on Linux and macOS.
However, some Windows‑specific modules (e.g., PSWindowsUpdate) will fail. Use Get-Module -ListAvailable to verify compatibility. For cross‑platform updates always use -Scope CurrentUser to avoid permission issues.
# Update cross‑platform modules on Ubuntu
Update-Module -Name PowerShellGet, Pester -Scope CurrentUser
What is the fastest way to update all installed PowerShell modules with one command?
Answer: Use Get-InstalledModule | Update-Module -ErrorAction SilentlyContinue -Verbose to batch update all modules with minimal user interaction.
This pipes all installed modules into Update-Module. Add -WhatIf first to preview. To include pre‑release, use -AllowPrerelease. For production speed, combine with -Force to skip version checks.
Get-InstalledModule | Update-Module -Verbose -ErrorAction SilentlyContinue

Command Line Expert & Software Engineer
Welcome! I’m Thomas Heinrich, a software engineer and system administrator with a deep passion for the Command Line Interface (CLI). With years of experience navigating the terminal, building backend architectures, and automating server deployments, I created this space to share practical, real-world terminal knowledge.
Whether you are a beginner taking your first steps in a Linux environment or a seasoned DevOps engineer looking to optimize your deployment scripts, you will find actionable solutions here. My goal is to help you ditch the mouse, speed up your workflow, and harness the full power of the command line.