All because PS7 doesn’t support System.Web anymore ;).
So, you may be able to do something similar. Obviously, it has its limitations and returning variables will be more difficult.
Alternative would be to create another dashboard entirely, set the URL for the dashboard as the full URL of the page that needs to run in 5.1 and move that page to this other dashboard. Navigation wouldn’t change this way, and you would be running native 5.1.
Sorry for the delayed answer. Unfortunately I’m very busy with some other issues @work and didn’t have time to verifiy your proposed solution.
However let me tell you that both of them are very smart!
I think that I will try your second suggestion because the Invoke-Command variant is probably an “overkill” since I need some specific Citrix dlls to be loaded.
Going with a dedicated “pseudo Dashboard” which only presents this subpage however looks like a potential solution / workaround to the problem.
As soon as I can try it (maybe tomorrow or monday) I will report about the results.
Sorry it took really long for me to come back with a feedback here.
Just wanted to update you and say that your intended solution of “nesting” the relevant POSH 5.1 Site into a PWSH 7.x Dashboard does not really work 100% seamless.
The reason is that we’re using a Navigation as well and basically I’d need to maintain that main Dashboard section twice and to be honest it would really be just a workaround.
Your first method though is something that I think @adam will decativeate / avoid soon based on the issue he opened here:
Probably the best and cleanest way would be to be able to override / specify the wished environment on a per subpage setting rather then on a Dashboard basis only… Like we can do for the Scripts, where you also can specify the desired Environment in the Edit Settings of the Script:
This is true about nesting the dashboard, you would have to find a clever way to make it more seemless (perhaps maintaining the navigation in a single file?)
For the second, that doesn’t affect it. That is about Powershell 7 trying to load Windows Powershell modules in compatibility mode. Doing an Invoke-Command is actually starting a seperate Windows Powershell instance, running a command, and returning the result.
The idea of having different subpages on different environments is basically the same as the workaround of having an entire new dashboard. They would be running in separate processes with their own sets of variables.
OK thanks for the clarification about the mentioned issue on github.
Regarding the idea of having subpages specifically configured for a particular Environment, I think this would resolve all the problems, also the need of having to create an entire new Dashboard with its dependencies and complexity and so avoid potential issues. As you mentioned it would anyway start a new process on its own and therefore resolve all caveats I think… Additionally it would be really “seamless”. no need to do some “hacky stuff” to workaround some 3rd party limitations…