Itdaily - Microsoft replaces PowerShell 5.1 with version 7 in next Windows 11 release

Microsoft replaces PowerShell 5.1 with version 7 in next Windows 11 release

Windows PowerShell window on a screen, showing Microsoft's startup message.
Image: Nwz/Shutterstock

Microsoft will ship PowerShell 7 by default with the next version of Windows 11, while PowerShell 5.1 will be phased out step by step after version 26H2.

Microsoft is including PowerShell 7 in the next release of Windows, the company announced on 17 November. The modern version of the command-line tool will succeed Windows PowerShell 5.1. That older version is no longer under active development and will not receive new features. Windows 11 26H2 and Windows Server 2025 are the last versions in which PowerShell 5.1 is enabled by default.

PowerShell 7 has existed since 2019 and can already be installed separately via the Microsoft Store. Microsoft does not yet name the new Windows version, but it will probably be 27H2, Thurrott writes.

Phasing out PowerShell 5.1

“For years, PowerShell lived in two places,” writes Jason Helmick, senior product manager at Microsoft. According to him, Windows PowerShell 5.1 is built into Windows and runs a large share of the world’s automation: scheduled tasks, services and management scripts. “PowerShell 7 is the modern PowerShell: the one we develop in the open, across multiple platforms, and where new features land.”

In the next Windows version, PowerShell 5.1 remains available as a Feature on Demand, enabled by default on new installations. In a later version it will disappear entirely. According to Microsoft, when that happens depends on usage data, and the company will announce it in advance. Until then, PowerShell 5.1 will receive security updates in line with the lifecycle of each Windows version.

Existing scripts will keep working, because PowerShell 7 runs alongside PowerShell 5.1. A script that starts powershell.exe uses version 5.1. Starting pwsh.exe launches PowerShell 7.

Work still to do on MSIX package

Microsoft delivers PowerShell 7 in Windows as an MSIX package, and that cannot yet do everything the MSI installer package could. The company is working on support for the SYSTEM account, which is needed for scheduled tasks, services, device management scripts and remoting. The DISM cmdlets, such as Add-WindowsCapability, and machine-wide settings, such as the profile for all users, are also still missing.

Many scripts run without modification in PowerShell 7, but not all of them: some need to be rewritten or are better left in PowerShell 5.1. “Knowing which of your scripts need changes is the harder work, especially across many machines,” writes Helmick. Microsoft is therefore investing in community tools, documentation and better compatibility checks in PSScriptAnalyzer. A new Inbox Working Group will track problems with PowerShell 7 in Windows.

Testing scripts for PowerShell 7

Microsoft advises IT professionals to start mapping now what uses PowerShell 5.1: scripts, scheduled tasks, installers and management agents. It is best to build new automation in PowerShell 7 right away, and to test existing scripts there before migrating them. You can report problems in the PowerShell GitHub repository.