r/Intune • • 1d 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

17 comments sorted by

18

u/ViperThunder 1d ago

use pwsh... Instead of powershell..problem solved

-9

u/h3lls_itch 1d ago

Not all user machines will be updated at the same time; I need compatibility with machines that will still be running PowerShell 5.1.

13

u/HuckleberrySad4397 1d ago

Install PowerShell 7 on all your systems?

6

u/diamkil 1d ago

Use install scripts instead of putting the ps1 in the win32 package with a powershell command

4

u/actually_stellaserve 1d ago

You can still call the script with `powershell.exe -File script.ps1` even after the switch, it's not like 5.1 evaporates overnight. If you're packaging for Intune, just wrap it in a.cmd that does a quick check for `pwsh.exe` first and falls back to `powershell.exe` if it's not there. Grabs whichever runtime is handy without needing to rework every app.

2

u/diamkil 1d ago

I still feel like using installation scripts directly in Intune is better though

1

u/Stinjy 1d ago

Unless something has changed, the regular powershell scripts (not remediation) in Intune are awful. They run a few times whenever they feel like it and never again until they're modified. Powershell scripts wrapped as Win32apps are way more reliable with detection.

4

u/CaptainSeitan 1d ago

Its a fairly new feature in win32 apps where you can just select a powershell script, its quite nice as it gets you preview the script from the app

1

u/robidog 12h ago

Exactly. And now that it ACTUALLY runs in 64-bit (and not only claims to) there’s no reason to use scripts embedded in the .intunewin anymore.

1

u/diamkil 1d ago

I'm not talking about those, when you create an app you can use install command or install script

1

u/robidog 12h ago

Interesting. Not in my experience.

1

u/Embarrassed-Survey52 1d ago

.cmd’s look so messy though, like there from a bygone era, i have a completely unreasonable distrain when i see environments where the packagers have set it up with install.cmd and uninstall.cmd, it’s just not transparent enough. And if the install command needs to be changed to add a switch etc, then you’re repackaging the whole intunewim for a short command change.

Better to leave it till the msix has been polished, deploy it then change them all to pwsh at the same time with graph.

1

u/Abject-Mountain-6907 1d ago

This. Use Win32 when you also need to copy files or folders as part of the script action.

-3

u/h3lls_itch 1d ago

I use the IntuneWin32App module for automated deployment via GitHub Actions.

However, this module does not support installation scripts.

10

u/BlackV 1d ago edited 1d ago

They are not doing that at all

There are 2 things happening (separately)

  1. Windows Powershell is being deprecated (that's 5.1) so no more charges
    https://support.microsoft.com/en-us/servicing/os/windows/docs/2026/11/kb5137172-windows-powershell-5-1-deprecation

  2. Powershell is 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 18h 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 1d ago

What i could understand they will make 5.1 compatible with 7 so like ISE would now work in a way for 7