01-11-2018 09:25 AM
01-11-2018 09:25 AM
Do existing PowerShell scripts need to be rewritten in PowerShell Core 6.0? Could things break if that's not done? When might scripts need to be rewritten - that is, what's the overall timeline for the switch to PowerShell Core?
01-11-2018 09:28 AM
01-11-2018 09:29 AM
01-11-2018 09:35 AMSolution
01-11-2018 09:43 AM
Many Windows PowerShell scripts will (and do) work just fine on PowerShell Core. Ultimately, your compatibility is going to depend on whether or not the underlying .NET or cmdlet dependencies are available in PowerShell Core. Many of the .NET classes that you might use with Add-Type or as a required assembly in your module are available as part of .NET Standard. Many modules already support PowerShell Core (as you can see on the Gallery), and even some that don't explicitly support PowerShell Core "just work" when you add your Windows PowerS....
Over time, we'll be doing more to make modules more compatible via the WindowsPowerShellCompatibilityPack module.
As for the "switch to PowerShell Core", we hope that you're able to switch as soon as possible, but due to the amount of usage, we'll be supporting Windows PowerShell for a long time. At least as long as Windows 10 and Windows Server 2016 are supported, as Windows PowerShell is a shipping component in those: https://support.microsoft.com/en-us/help/13853/windows-lifecycle-fact-sheet
01-11-2018 09:44 AM
Steve's response might have been marked as the "best response", but it's incomplete. There are significant breaking changes between PS 5.1 and PS 6.0. The release documentation goes into some of them in detail (but the only relatively complete list is to look at the changelog on GitHub). Some of these changes will fail silently.
You literally will need to re-test non-trivial scripts to ensure they still work the same way on PS 6 as they did previously.
01-11-2018 09:46 AM
01-12-2018 10:00 AM
If you're making the conscious decision to switch to PowerShell Core, wouldn't you always test scripts?
3 hours ago
Michael is correct that although many scripts may work, we did make some small changes based on community feedback that may change behavior is more subtle ways. One should always test their scripts before deploying them. There is work happening to create PSScriptAnalyzer rules to identify parts of script that are not PSCore6 compatible.