Windows PowerShell 5.1 is deprecated, but it sounds like it will still be supported for a while. Should we be moving everything to PowerShell 7 now, and what happens to modules that still need 5.1?
What does PowerShell 5.1 deprecation mean for existing scripts?
Answers
Deprecated doesn't mean disabled today. Windows PowerShell 5.1 is no longer in active development, but it remains supported and gets security updates according to the lifecycle of the Windows version it's on. Existing scripts can keep running while it's available.
Microsoft plans to remove it from a future Windows version, with timing based on usage data and advance notice. The announced transition includes a version where it's available as a Feature on Demand and enabled by default on new installs. There's no removal date in that announcement, so this is a planning task, not an emergency rewrite.
Reply to this answer
The tricky bit is module compatibility. PowerShell 7 can use a compatibility layer for some Windows PowerShell modules, but that runs them through a 5.1 process. It isn't a way to get rid of the dependency, and serialized objects can behave differently from the original objects.
Check your scheduled tasks and scripts for management modules such as GroupPolicy, DhcpServer, DFSR and IIS. Then test the actual commands and output your automation relies on under PowerShell 7. A successful import alone doesn't prove the whole job works without 5.1.
Reply to this answer
Don't assume every workflow has a supported PowerShell 7 replacement yet. Some hybrid identity procedures, including Kerberos key rotation, have guidance to use 5.1. Check the current instructions for each workflow before switching it, especially for administrative jobs that don't run often.
Reply to this answer
There's a real open question around Windows management modules that are untested in PowerShell 7 or depend on the compatibility layer. The removal announcement doesn't say whether each affected module will get a native replacement, so I'd track those dependencies separately rather than assume they'll all be fixed in time.
Reply to this answer
Also test the way your admins launch their tools, not just the scripts themselves. Run As Another User and the editor people use can be part of the workflow, so a move to PowerShell 7 may need some changes outside the code too.
Reply to this answer
Add your answer
Answers are reviewed before publication.
7c~gobletwhisk_536:
So a script launched from PowerShell 7 can still have a hidden 5.1 dependency?
Tavdexo+2h:
Yes. If it uses the Windows PowerShell compatibility layer, the module runs in a 5.1 process even though the calling session is PowerShell 7.