Many of us need it, but for just as many it is sometimes a nuisance. What I am talking about is PowerShell 7 module compatibility. In this post I will show how to make PowerShell 5 modules PowerShell 7 executable. Let’s dive in.
We all know the issue that we cannot run all common PowerShell 5 commands in PowerShell 7. Therefore I will show you a parameter that can solve this problem.
For example, I want to run Get-EventLog. This cmdlet is part of the Microsoft.PowerShell.Manangement module in PowerShell 5 and definitely not available in PowerShell 7.

But with a small fine parameter we can import the module from PowerShell 5 to PowerShell 7 and thus run the cmdlet.
I am now goint to import the module in PowerShell 7 and use the -UseWindowsPowerShell parameter.
Import-Module Microsoft.PowerShell.Management -UseWindowsPowerShell -WarningAction Ignore
Voila, now we can use the cmdlet.

Categories: PowerShell