Microsoft will include PowerShell 7 by default in the next Windows release as an upgrade to Windows PowerShell 5.1. Existing scripts will continue to work as usual, since both versions run side by side. However, the PowerShell team still needs to address a few issues before version 7 is fully operational.
The PowerShell team announced the move on its developer blog. KB5137172, a support document that marks Windows PowerShell 5.1 as deprecated, outlines the details. According to Microsoft, version 5.1 will remain part of Windows for now. For new scripts and automation, the company recommends PowerShell 7.
This ends a situation that has existed for years. Windows PowerShell 5.1 is included by default in Windows and runs countless scheduled tasks, services, and management scripts. PowerShell 7 is the modern, open-source version that works across multiple platforms and receives new features.
What does this mean for existing scripts? Nothing, according to Microsoft. PowerShell 5.1 will remain available as powershell.exe, while PowerShell 7 runs via pwsh.exe. Therefore, existing automation does not need to be modified. Administrators can make the switch when they’re ready.
PowerShell 7 is delivered as an MSIX package instead of the traditional MSI installer, and that format doesn’t yet support everything the MSI version does. The team is working on three outstanding issues: running under the SYSTEM account (important for scheduled tasks, services, device management scripts, and remoting), support for DISM cmdlets such as Add-WindowsCapability, and machine-wide settings such as the all-users profile.
Test first, then migrate
Many scripts work in PowerShell 7 without any modifications. But not all of them. Some require changes, while others may need to continue running in version 5.1 because the two versions differ in certain respects. Microsoft recommends testing scripts first and refers to documentation covering those differences and migration, including modules, profiles, and remoting.
It’s harder to determine, across many machines, which scripts need attention. To address this, Microsoft is investing in community tools, documentation, and improved compatibility checks in PSScriptAnalyzer. These tools are designed to cover three areas: an inventory of scripts, scheduled tasks, and services; an analysis of what needs to be modified; and specific guidelines for each finding. Microsoft will release these components as soon as they are ready.
In addition, the company is launching an Inbox Working Group. This group will triage issues with PowerShell 7 in Windows and ensure that reported issues are routed to the right people.
Tip: Microsoft’s laxity in the PowerShell Gallery is inviting supply chain attacks