PowerShell 7 compatibility with PowerShell 5

Copper Contributor

Hi just like to ask if a .ps1 file written in PowerShell 7 can work in PowerShell 5 without any major issues?

2 Replies
That's way too broader question to be able to give you a specific answer. Depends on the module(s) used, generally speaking. Take a look at the following guidance: https://docs.microsoft.com/en-us/powershell/scripting/whats-new/migrating-from-windows-powershell-51...
In most cases, you can get away with the majority of the issues by using the -UseWindowsPowerShell switch.

@Vasil Michev 

 

Thanks for your answer and help on this.

 

Ok, will see and try things out first then