PowerShell 7.1, released on November 11, 2020, is a long-term servicing (LTS) version that builds on the cross-platform PowerShell 7.0. This release focuses on stability, bug fixes, and a few key improvements, making it a reliable choice for IT professionals and developers who need a consistent scripting environment across Windows, macOS, and Linux.
Background: Why PowerShell 7.1 Exists
PowerShell 7.0, released in March 2020, was the first version based on .NET Core 3.1 and marked the transition from the Windows-only Windows PowerShell 5.1 to a truly cross-platform tool. However, 7.0 was not designated as an LTS release; it received support only until a short time after the next version appeared. PowerShell 7.1, based on .NET 5, was the first LTS version, meaning it receives security and critical bug fixes for a longer period—typically three years from its release date. This designation makes 7.1 a preferred choice for enterprises that require stability and a predictable support lifecycle.
Key Features and Changes in 7.1
While 7.1 is primarily a refinement release, it introduced several notable improvements and fixes:
- Cross-platform consistency: Many cmdlets that behaved differently on Linux or macOS were aligned with Windows behavior, reducing surprises when running scripts across different OSes.
- Performance improvements: Some operations, particularly those involving large collections or pipeline processing, became faster due to optimizations in the underlying .NET 5 runtime.
- Bug fixes: Over 100 issues were resolved, including problems with the
ForEach-Object -Parallelfeature, which had been introduced in 7.0. - New experimental features: A few experimental features were promoted to stable, while others were added for testing, giving users a glimpse of what might come in future releases.
One notable change is the removal of the Out-GridView cmdlet on non-Windows platforms, as it relies on Windows Forms. This was a breaking change for some scripts, but it was necessary for maintaining a clean cross-platform codebase.
How to Install or Upgrade to 7.1
If you already have PowerShell 7.0 installed, upgrading to 7.1 is straightforward. You can download the installer from the official GitHub releases page or use a package manager:
- Windows: Use the MSI installer or run
winget install Microsoft.PowerShell(if you have Windows Package Manager). - macOS: Use Homebrew:
brew install --cask powershell. - Linux: Use the package manager for your distro (e.g.,
aptfor Ubuntu,dnffor Fedora).
After installation, you can check the version by running $PSVersionTable or pwsh --version. The executable is named pwsh to avoid conflicts with the legacy Windows PowerShell.
Choosing Between 7.1 and Other Versions
Selecting the right PowerShell version depends on your needs:
- PowerShell 7.1 (LTS): Best for production environments and enterprise deployments where stability and long-term support are critical.
- PowerShell 7.2 and later: These are non-LTS releases with newer features and faster innovation, but they have a shorter support window. If you need the latest capabilities, choose a recent stable version.
- Windows PowerShell 5.1: Still included with Windows and required for some legacy modules, but it is not cross-platform and is in maintenance mode.
A common misconception is that you must choose between 7.1 and 5.1. In fact, they can coexist on the same machine, and you can use the #requires directive in scripts to specify which version they need.
Common Problems and Solutions
Users migrating from Windows PowerShell 5.1 to 7.1 often encounter a few issues:
- Missing modules: Some Windows-specific modules (e.g.,
ActiveDirectory) are not available in PowerShell 7.1. You can use theWindowsCompatibilitymodule to load them in a Windows PowerShell compatibility session. - Script breaks due to strict mode: PowerShell 7.1 is more strict about uninitialized variables in some cases. Review your scripts for undefined variables and use
Set-StrictMode -Version 2.0to test. - Execution policy errors: On Windows, you may need to set the execution policy to
RemoteSignedorUnrestrictedto run scripts. UseSet-ExecutionPolicy -ExecutionPolicy RemoteSigned.
If you encounter a problem that seems like a bug, check the GitHub issues page for PowerShell to see if it has already been reported and if a workaround exists.
Comparing PowerShell 7.1 with Windows PowerShell 5.1
PowerShell 7.1 and Windows PowerShell 5.1 differ in several key ways:
- Platform: 7.1 runs on Windows, macOS, and Linux; 5.1 runs only on Windows.
- Underlying runtime: 7.1 uses .NET 5 (now .NET 6+ for later versions), while 5.1 uses the .NET Framework 4.x.
- New operators and syntax: 7.1 supports ternary operators (
condition ? iftrue : iffalse), null-coalescing (??), and pipeline chaining (||and&&), which are not in 5.1. - Parallel execution: 7.1 has
ForEach-Object -Parallelfor simple parallel processing, which is not available in 5.1.
For most new scripts, 7.1 is the better choice, but you may need to keep 5.1 for compatibility with older modules and tools.
Security and Best Practices
When using PowerShell 7.1, follow these security guidelines:
- Keep it updated: Although 7.1 is LTS, it still receives security patches. Apply them promptly.
- Use execution policies: On Windows, set an appropriate execution policy to prevent unauthorized scripts from running.
- Use Constrained Language Mode: For constrained environments, restrict PowerShell to a limited set of commands to reduce risk.
- Validate input: Always validate parameters in your scripts to avoid injection attacks.
Remember that PowerShell itself is not a security boundary; it is a tool that can be used for both good and bad. Always run scripts from trusted sources and review them before execution.
Frequently Asked Questions
Is PowerShell 7.1 still supported?
No, PowerShell 7.1 reached its end of support on December 13, 2022. Microsoft recommends upgrading to a newer LTS version, such as PowerShell 7.2 or 7.4, to continue receiving security updates and bug fixes.
Can I run PowerShell 7.1 alongside Windows PowerShell 5.1?
Yes, you can install and run both versions side by side. The executable for 7.1 is pwsh.exe, while Windows PowerShell remains powershell.exe. They are completely independent and can be used interchangeably, though they share some profile paths if you configure them.
What is the difference between LTS and non-LTS releases?
LTS (Long-Term Servicing) releases receive security and critical fixes for a longer period (typically 3 years). Non-LTS releases are supported only until the next version is released (about 6 months). LTS is recommended for production environments where stability is more important than new features.
Does PowerShell 7.1 work on Windows 11?
Yes, PowerShell 7.1 works on Windows 11, but since it is no longer supported, it is recommended to upgrade to a supported version. Windows 11 includes Windows PowerShell 5.1, but you can install any newer PowerShell version.
How do I update from PowerShell 7.1 to a newer version?
You can download the latest installer from the official GitHub releases page and run it. The installer will replace the existing installation if you choose the same installation directory. Alternatively, you can use a package manager like winget on Windows or brew on macOS.
Related
Formula used
in t | Time (seconds) | s | 10 | 0 | 3600 out msg | Message | - | "PowerShell 7.1 is LTS" | 0
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Amazon Rufus AI Chat vs Perplexity: Which Is Better?
- Tiny Local LLM Setup: Can Your Device Handle It?
- Robocopy Commands: Full List and What They Do
- Disturbing AI Food Videos: Why Cute Creatures Become Horror
- How to Fix “This Site Can’t Provide a Secure Connection”
- Message to Humanity: What Should AI Do With Its Power?