r/Intune • u/h3lls_itch • 2d ago
App Deployment/Packaging Replacing PowerShell 5.1 with PowerShell Core
Microsoft has announced that PowerShell Core will replace PowerShell 5.1 in future versions of Windows.
My concern relates to installation and uninstallation commands.
Currently, I use the "powershell ..." command for all applications.
In PowerShell 7, the command begins with "pwsh".
How can this be resolved?
0
Upvotes
18
u/ViperThunder 2d ago
use pwsh... Instead of powershell..problem solved
6
u/diamkil 2d ago
Use install scripts instead of putting the ps1 in the win32 package with a powershell command
10
u/BlackV 2d ago edited 2d ago
They are not doing that at all
There are 2 things happening (separately)
Windows Powershellis being deprecated (that's 5.1) so no more chargeshttps://support.microsoft.com/en-us/servicing/os/windows/docs/2026/11/kb5137172-windows-powershell-5-1-deprecation
Powershellis being added as an inbox app (that is currently 7.x)https://devblogs.microsoft.com/powershell/powershell-7-coming-to-windows/
Again 2 separate events, and on top of those changes they are removing the MSI install for Powershell after 7.6.x to MSIX, but do not currently have feature parity for that and break a bunch of things
But your code should be tested and handling that anyway
2
u/sneesnoosnake 1d ago
Powershell 5.1 will still be there in all it's glory. Stop worrying about production and move to PS7 as you have time to review your scripts. Everything will still work.
(Yes it will be a Feature on Demand but it will be active by default)
2
u/bill696 2d ago
What i could understand they will make 5.1 compatible with 7 so like ISE would now work in a way for 7
1
u/Optanik 4h ago
You can't really replace 5.1, since Windows PowerShell is part of the OS and Intune platform scripts and remediations run under it. What usually works is deploying PowerShell 7 side by side (the MSI as a Win32 app, or winget), then calling it where you need it. For Win32 apps, put pwsh.exe -ExecutionPolicy Bypass -File script.ps1 straight in the install command. For platform scripts and remediations, keep a small 5.1 wrapper that checks pwsh.exe exists and runs the real script with it, passing the exit code back so detection and reporting still work. Remember that modules installed for 5.1 aren't always picked up by 7 and the other way round, so check module paths if something works locally but fails from Intune.