PowerShell 7 installs with the winget install --id Microsoft.PowerShell command on Windows 10 and 11, and it runs side-by-side with Windows PowerShell 5.1 rather than replacing it. Use the MSI, winget, or GitHub release package for a standalone install; the built-in 5.1 engine stays available for legacy modules.
Install and Verify PowerShell 7
Open Windows Terminal or PowerShell, then run the commands in order. The winget route pulls the current stable release; the verification step confirms which engine answered.
winget install --id Microsoft.PowerShell --source winget
pwsh -NoProfile -Command '$PSVersionTable.PSVersion'
Get-Command pwsh | Select-Object Source, Version
| Task | Command / Shortcut | Notes |
|---|---|---|
| Launch PowerShell 7 | pwsh |
Separate executable from powershell.exe (5.1) |
| Launch Windows PowerShell 5.1 | powershell.exe |
Built into Windows |
| Check version | $PSVersionTable.PSVersion |
Confirms 7.x vs 5.1 |
| List all hosts | Get-Command pwsh, powershell |
Shows both paths |
| Update PowerShell 7 | winget upgrade --id Microsoft.PowerShell |
Pulls latest stable |
| Open profile in editor | notepad $PROFILE |
Creates profile if missing |
Confirm success by reading the Major value in $PSVersionTable; 7 or higher means you're in the modern engine. If pwsh returns "not recognized," close and reopen the terminal so the updated PATH loads, or run the MSI installer instead.
How PowerShell 7 Coexists With Windows PowerShell 5.1
PowerShell 7 installs to its own directory ($env:ProgramFiles\PowerShell\7) and never overwrites C:\Windows\System32\WindowsPowerShell\v1.0. That separation is intentional: 5.1 still ships in the box on Windows, and 7 adds modern cross-platform commands, faster parsing, and the modules updated for .NET 11 in the 7.7 line. Scripts written for 5.1 keep running under powershell.exe; scripts targeting 7 use pwsh.
To check which host a scheduled task or shortcut actually invokes, inspect the action path. A task pointing at powershell.exe runs 5.1 even after you install 7. Update the task to pwsh.exe when the script uses 7-only syntax such as the ternary operator ($a ? $b : $c) or null-coalescing (??).
The official Microsoft install page documents MSI, ZIP, and winget options for the standalone package:
Install PowerShell 7 on Windows
Three Worked Examples
Example 1: Default install and version confirmation
Start on a clean Windows 11 machine with no PowerShell 7 present. Run winget install --id Microsoft.PowerShell, accept the source agreement, and wait for the success message. Then:
pwsh -NoProfile -Command '$PSVersionTable | Format-List PSVersion, PSEdition, OS'
A correct result shows PSEdition : Core, a PSVersion of 7.x, and your OS string. If PSEdition reads Desktop, you're still in 5.1 and need to launch pwsh explicitly.
Example 2: Side-by-side module check
Rows in this example refer to commands, not spreadsheet rows. Install the Az module for cloud work in 7, then confirm it loads there while 5.1 is unaffected:
pwsh -NoProfile -Command 'Install-Module Az -Scope CurrentUser -Force; (Get-Module -ListAvailable Az).Version'
powershell.exe -NoProfile -Command '(Get-Module -ListAvailable Az).Version'
The first line prints the Az version from the 7 host; the second returns nothing if Az was never installed for 5.1. This proves the two engines keep separate module paths under $env:USERPROFILE\Documents\PowerShell\Modules versus ...\WindowsPowerShell\Modules.
Example 3: Point a script at the right engine
A scheduled task runs C:\Scripts\Report.ps1. In the task's Actions tab, set Program/script to pwsh.exe and Add arguments to -NoProfile -File "C:\Scripts\Report.ps1". Verify by running the same arguments manually:
pwsh -NoProfile -File "C:\Scripts\Report.ps1"
If the script throws a parser error about syntax only supported in 7 (for example ??=), the task is still calling powershell.exe — correct the Program/script field.
Troubleshooting Errors and Failed Installs
| Error / Symptom | Likely cause | Verified fix |
|---|---|---|
'pwsh' is not recognized |
PATH not refreshed after install |
Reopen terminal, or run the MSI and restart |
winget fails with 0x8A15002B (package not found) |
Missing winget source or old App Installer |
Update Microsoft Store App Installer, then rerun with --source winget |
Install-Module prompts about untrusted repository |
PSGallery not trusted |
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted |
PSScriptPolicyTest or script won't run |
Execution policy in 5.1, not 7 | Run Get-ExecutionPolicy in pwsh; set Set-ExecutionPolicy -Scope CurrentUser RemoteSigned |
| Module fails only in 7 | Module isn't .NET-compatible | Try the Windows Compatibility feature, or run it under powershell.exe |
Access denied during install |
Not elevated and scope is AllUsers |
Rerun terminal as Administrator, or use -Scope CurrentUser |
$PSVersionTable shows 5.1 |
Launched powershell.exe |
Explicitly start pwsh |
The version you'll actually see depends on the servicing channel. LTS releases (such as 7.6) receive only critical security and servicing updates; stable releases (such as 7.5) get features and fixes between LTS points. Check the current supported build against the official lifecycle table before standardizing a fleet:
When an install fails, capture the actual exit code with winget install --id Microsoft.PowerShell --source winget; $LASTEXITCODE. A code of 0 means success even if the console scrolled past the confirmation.
Frequently Asked Questions
Does installing PowerShell 7 remove Windows PowerShell 5.1?
No. The two engines install to separate directories and run side-by-side. powershell.exe stays on the system and continues to serve legacy scripts that rely on 5.1-only modules.
How do I make PowerShell 7 my default in Windows Terminal?
Open Settings > Startup and set Default profile to the PowerShell 7 entry, which appears automatically after installation. If it's missing, choose Add a new profile > PowerShell and point the command line to pwsh.exe.
Can a script detect which PowerShell version it's running in?
Yes. Check $PSVersionTable.PSEdition — Core means PowerShell 7+, Desktop means Windows PowerShell 5.1. Gate 7-only syntax behind if ($PSVersionTable.PSVersion.Major -ge 7) so the same script runs in both engines without parser errors.