Installing and Upgrading PowerShell 7 on Windows
I originally saw the prompt that appeared when starting Windows PowerShell: "Install the latest PowerShell for new features and improvements!", and I thought it just meant I hadn't updated to the latest version. It wasn't until I clicked it that I realized versions before 5 and after 6 are actually different products, and the Windows prompt to install the latest PowerShell page contains this statement:
Do I need to install PowerShell 7? No, unless you have specific feature requirements for PowerShell 7, you do not need to install it.
Since the official documentation clearly states that it is not necessary to install it without specific requirements, I ignored it. However, I later found that the Copilot CLI script tool requires PowerShell v6 or later, and only provides experimental support for Windows PowerShell 5.1 with a version check block, so I had to go back and install it. I decided to write this guide for future maintenance.
Differences between Windows PowerShell and PowerShell 7
Windows PowerShell and PowerShell 7 are completely different product lines (the current latest versions are 5.1 and 7.6 respectively, with 7.6 being an LTS version). For detailed explanations, please refer to the official PowerShell documentation.
- Underlying Architecture: Windows PowerShell is based on the closed-source .NET Framework and is limited to Windows systems; PowerShell 7 is based on open-source .NET (currently 7.6 uses .NET 10) and can run cross-platform on Windows, Linux, macOS, and even in Docker containers.
- Lifecycle and Positioning: Windows PowerShell has stopped new feature development and only receives maintenance updates; no new features will be added.
- Default Encoding and Encoding Issues: PowerShell 7 uniformly adopts UTF-8 (without BOM) as the default encoding for all output, solving the encoding issues that frequently occurred in the Windows PowerShell era when handling plain text files, Chinese characters, or interacting with Git.
- Executable Isolation: Both can coexist on the same computer without interfering with each other. The Windows PowerShell executable is named
powershell.exe, while PowerShell 7 is renamed topwsh.exeto distinguish it.
Installation Guide
WinGet automatically sets environment variables (adds pwsh.exe to PATH) after installation, so no manual configuration is required.
Search for available versions:
winget search --id Microsoft.PowerShellInstall the latest stable version (e.g., 7.6):
winget install --id Microsoft.PowerShell --source wingetUpgrade to the latest version with one click:
winget upgrade --id Microsoft.PowerShellUninstall:
winget uninstall --id Microsoft.PowerShellGet-Help Documentation Mechanism
Installing PowerShell only installs the "execution engine." Detailed offline documentation (including examples and parameter explanations) is not bundled by default and needs to be downloaded separately. If you want to view examples using -Examples or view full parameter descriptions using -Detailed but get no output, it is likely that the help files have not been downloaded yet.
If you need full example documentation, there are two ways:
Online Query: Add the
-Onlineparameter after the command (e.g.,Get-Help Get-Process -Online) to open the browser and view the official web version of the documentation, which does not take up local space.Download Offline Files: Run the following command as an administrator to download the help files to your local machine:
powershellUpdate-Help -UICulture zh-tw, en-US -Force -ErrorAction SilentlyContinue
Explanation of parameters:
-UICulture zh-tw, en-US: Specifies the download language.en-USis added as a fallback because some modules do not have Traditional Chinese documentation.-Force: Forces a re-download even if the local help files are already up to date.-ErrorAction SilentlyContinue: Ignores failure error output. Some modules do not provide online help files; if this parameter is not added, the terminal will display a large number of red error messages, but this does not affect the download of other modules.
For a complete explanation of the Updatable Help mechanism, please refer to about_Updatable_Help.
For all parameter descriptions of Get-Help, please refer to Get-Help.
Example of Differences Before and After Downloading Documentation
The following is a comparison of the output of Get-Help Get-Process before and after downloading the documentation.
Before downloading, only basic syntax is available, and a prompt at the end indicates that the help file does not exist:
NAME
Get-Process
SYNTAX
Get-Process [[-Name] <string[]>] [-Module] [-FileVersionInfo] [<CommonParameters>]
Get-Process [[-Name] <string[]>] -IncludeUserName [<CommonParameters>]
Get-Process -Id <int[]> [-Module] [-FileVersionInfo] [<CommonParameters>]
Get-Process -Id <int[]> -IncludeUserName [<CommonParameters>]
Get-Process -InputObject <Process[]> [-Module] [-FileVersionInfo] [<CommonParameters>]
Get-Process -InputObject <Process[]> -IncludeUserName [<CommonParameters>]
ALIASES
gps
ps
REMARKS
Get-Help cannot find the Help files for this cmdlet on this computer. It is displaying only partial help.
-- To download and install Help files for the module that includes this cmdlet, use Update-Help.
-- To view the Help topic for this cmdlet online, type: "Get-Help Get-Process -Online" or
go to https://go.microsoft.com/fwlink/?LinkID=2096814.After downloading, it includes a full description, syntax, and related links:
NAME
Get-Process
SYNOPSIS
Gets the processes that are running on the local computer.
SYNTAX
Get-Process [-FileVersionInfo <System.Management.Automation.SwitchParameter>] [-Module <System.Management.Automatio
n.SwitchParameter>] [[-Name] <System.String[]>] [<CommonParameters>]
Get-Process -IncludeUserName <System.Management.Automation.SwitchParameter> [[-Name] <System.String[]>] [<CommonPar
ameters>]
Get-Process [-FileVersionInfo <System.Management.Automation.SwitchParameter>] -Id <System.Int32[]> [-Module <System
.Management.Automation.SwitchParameter>] [<CommonParameters>]
Get-Process -Id <System.Int32[]> -IncludeUserName <System.Management.Automation.SwitchParameter> [<CommonParameters
>]
Get-Process [-FileVersionInfo <System.Management.Automation.SwitchParameter>] -InputObject <System.Diagnostics.Proc
ess[]> [-Module <System.Management.Automation.SwitchParameter>] [<CommonParameters>]
Get-Process -IncludeUserName <System.Management.Automation.SwitchParameter> -InputObject <System.Diagnostics.Proces
s[]> [<CommonParameters>]
DESCRIPTION
The `Get-Process` cmdlet gets the processes on a local computer.
Without parameters, this cmdlet gets all processes on the local computer. You can also specify a specific process b
y process name or process ID (PID), or by piping a **System.Diagnostics.Process** object to this cmdlet.
By default, this cmdlet returns a **Process** object that has detailed information about the process and supports m
ethods that let you control it. With parameters, you can change the type of information returned by this cmdlet.
- **Module**: Retrieve information for each module loaded into the process. - **FileVersionInfo**: Retrieve file ve
rsion information for the main module of the process.
> [!NOTE] > A module is an executable file or a dynamic link library (DLL) loaded into a process. A process > has o
ne or more modules. The main module is the module used to initially start the process. For > more information, see
[ProcessModule Class](/dotnet/api/system.diagnostics.processmodule).
RELATED LINKS
Online Version https://learn.microsoft.com/powershell/module/microsoft.powershell.management/get-process?view=power
shell-7.5&WT.mc_id=ps-gethelp
Debug-Process Debug-Process.md
Get-Process Get-Process.md
Start-Process Start-Process.md
Stop-Process Stop-Process.md
Wait-Process Wait-Process.md
Where-Object ../Microsoft.PowerShell.Core/Where-Object.md
REMARKS
To see the examples, type: "Get-Help Get-Process -Examples"
For more information, type: "Get-Help Get-Process -Detailed"
For technical information, type: "Get-Help Get-Process -Full"
For online help, type: "Get-Help Get-Process -Online"When is it necessary to install the new version?
Based on my current experience, the following points make it worth installing the new version:
- AI Script Baseline: Scripts generated by AI are often based on PowerShell 6+, so they often fail to execute initially, and asking for the reason reveals it is a version issue.
- Encoding Issues: Currently, when mainstream tools write files, the UTF-8 encoding is default without BOM. If there are Chinese characters in the script, Windows PowerShell 5.1 will parse the script as ANSI, leading to string misinterpretation, garbled text, or execution failure.
- Minimum Version Requirements for Tools: Tools like Copilot CLI explicitly require PowerShell 6+, providing only experimental support for 5.1.
- Cross-platform Scripting Requirements: If you want to create tool scripts that can be used on Windows, Linux, and macOS, PowerShell 6+ is a necessary condition.
Both can coexist; there is no need to remove Windows PowerShell.
Change Log
- 2026-03-25 Initial document created.