Install Powershell 7
PowerShell 7 is the latest major release of PowerShell, it is a cross-platform task automation and configuration management framework from Microsoft.
- Cross-platform: It runs on Windows, macOS, and Linux.
- Open-source: The source code is available on GitHub.
- Built on .NET Core: PowerShell 7 is built on .NET Core 3.1, providing better performance and compatibility.
- Side-by-side installation: On Windows, it installs alongside Windows PowerShell 5.1, not replacing it.
- Long-term support (LTS) release: PowerShell 7 is the first LTS release, meaning extended support and stability.
- New features and improvements:
– Parallel processing with ForEach-Object -Parallel
– New operators like pipeline chain operators (&& and ||)
– Improved error handling and debugging
– Ternary operator (?:)
– Null coalescing operators (?? and ??=)
– New cmdlets like Get-Error and Invoke-RestMethod improvements - Better compatibility: Improved compatibility with existing Windows PowerShell modules.
- Enhanced remoting capabilities: Including SSH-based remoting.
- Improved performance: Faster startup times and better overall performance.
- Regular updates: Frequent releases with new features and improvements.
PowerShell 7 is designed to be the one-stop shop for automation and scripting needs across different platforms, combining the best of Windows PowerShell with the cross-platform capabilities introduced in PowerShell Core.
List below shows the main methods to install PowerShell 7 on Windows:
1. Using Winget (Recommended for Windows 10 and newer):
– Open PowerShell or Terminal as administrator
– Run the command: `winget install Microsoft.PowerShell`
2. Using Microsoft Store:
– Open Microsoft Store
– Search for “PowerShell”
– Click “Get” to install
3. Using MSI Package:
– Download the MSI installer from the Microsoft documentation or GitHub releases page
– Run the MSI file and follow the installation wizard
– For silent installation, use the command:
msiexec.exe /package PowerShell-7.4.1-win-x64.msi /quiet ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1 ADD_FILE_CONTEXT_MENU_RUNPOWERSHELL=1 ENABLE_PSREMOTING=1 REGISTER_MANIFEST=1 USE_MU=1 ENABLE_MU=1 ADD_PATH=1
4. Using ZIP Package (for advanced deployment scenarios):
– Download the ZIP archive from the release page
– Unzip the contents to your desired location
– Run `pwsh.exe` from that location
5. As a .NET Global Tool:
– If you have the .NET Core SDK installed, run:
dotnet tool install --global PowerShell
Key points:
– PowerShell 7 installs side-by-side with Windows PowerShell 5.1
– Default installation path is `$env:ProgramFiles\PowerShell\7`
– After installation, you need to specifically open PowerShell 7 to use it, as the default Windows PowerShell will still be version 5.1
– The Winget and Microsoft Store methods will automatically keep PowerShell updated
– The MSI method allows you to choose specific versions if needed
Choose the method that best suits your needs and system requirements.