WS-Management (WSMan) Remoting in PowerShell Core
Instructions to Create a Remoting Endpoint
The PowerShell Core package for Windows includes a WinRM plug-in (
pwrshplugin.dll) and an
installation script (
$PSHome. These files enable PowerShell
to accept incoming PowerShell remote connections when its endpoint is specified.
An installation of PowerShell can establish PowerShell sessions to remote computers using
Enter-PSSession. To enable it to accept incoming PowerShell remote
connections, the user must create a WinRM remoting endpoint. This is an explicit opt-in scenario
where the user runs Install-PowerShellRemoting.ps1 to create the WinRM endpoint. The installation
script is a short-term solution until we add additional functionality to
perform the same action. For more details, please see issue
- Creates a directory for the plug-in within
- Copies pwrshplugin.dll to that location
- Generates a configuration file
- Registers that plug-in with WinRM
The script must be executed within an Administrator-level PowerShell session and runs in two modes.
Executed by the instance of PowerShell that it will register
Executed by another instance of PowerShell on behalf of the instance that it will register
<path to powershell>\Install-PowerShellRemoting.ps1 -PowerShellHome "<absolute path to the instance's $PSHOME>"
Set-Location -Path 'C:\Program Files\PowerShell\6.0.0\' .\Install-PowerShellRemoting.ps1 -PowerShellHome "C:\Program Files\PowerShell\6.0.0\"
The remoting registration script restarts WinRM. All existing PSRP sessions are terminated immediately after the script is run. If run during a remote session, the script terminates the connection.
How to Connect to the New Endpoint
Create a PowerShell session to the new PowerShell endpoint by specifying
-ConfigurationName "some endpoint name". To connect to the PowerShell instance from the example
above, use either:
New-PSSession ... -ConfigurationName "powershell.6.0.0" Enter-PSSession ... -ConfigurationName "powershell.6.0.0"
Enter-PSSession invocations that do not specify
will target the default PowerShell endpoint,