powershellpowershell-core

How to automate either PowerShell or PowerShell Core for same machine


With the release of PowerShell Core, how can an application choose which version of Powershell (Powershell 5.x or PowerShell Core) is being called when it using hosting automation library (system.management.automation)? Something about the runspace that should be created? or maybe the connection info?


Solution

  • Here's an overview of the PowerShell SDK-related NuGet packages:Adapted from here.

    Note: System.Management.Automation is not recommended for direct use.


    As for targeting a specific edition / version via remoting:


    As Lee Dailey points out in a comment on the question, the edition-specific executable filenames are: