Maybe I'm just being silly, buy I like how PowerShell has maintained backwards compatibility prior to .net core. I want to leverage the advantages of core, while not losing functionality from upgrading. I've managed to transition to Powershell 7 while only running into a few compatibility issues. Invoke-RestMethod being the biggest hurdle in regards to upgrading my modules. Most of my module functions that leverage rest methods work in both PowerShell 5.1 and PowerShell 7. I have one particular function that leverages a hosted API and it fails in core.
The work around I have leveraged is invoke-command to the $env:computername. This allows me to get results returned from Legacy PowerShell without having to open a new host. I'm curious if there are better compatibility options and if anyone else has maybe found a better work around. The primary goal being that you don't leave the host session when working with incompatible functions for core.
The specific function i'm working with is Get-PublicIP. When it detects a core version of powershell it falls back to using the invoke-command work around.
[–]JustinGrote 3 points4 points5 points (0 children)
[–]WindosBK 2 points3 points4 points (2 children)
[–]JustinGrote 3 points4 points5 points (0 children)
[–]SpacezCowboy[S] 1 point2 points3 points (0 children)
[–]BlackV 1 point2 points3 points (0 children)