Powershell: PSRP over WSMan/WinRM from Linux/OSX to Windows

Created on 18 Aug 2016  路  9Comments  路  Source: PowerShell/PowerShell

I looked around for about an hour but did not find a clear statement on this. So I thought I just ask: Does Powershell for Linux and OSX have the ability to execute a command on a remote Windows machine without installing Microsoft's SSH server on that machine? Or is it PSRP-over-SSH only?

Thanks, Marcus

Issue-Question Resolution-Duplicate WG-Remoting

Most helpful comment

My command still fails is there a fix Mac->Windows ?
PS /Users/ikonstas> New-PSSession -ComputerName 10.178.228.100 -Credential administrator

PowerShell credential request
Enter your credentials.
Password for user administrator: ****

New-PSSession : MI_RESULT_ACCESS_DENIED
At line:1 char:1

  • New-PSSession -ComputerName 10.178.228.100 -Credential administrator
  • ~~~~~~~~~~~~~~~~

    • CategoryInfo : InvalidOperation: (:) [New-PSSession], PSInvalidOperationException

    • FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.NewPSSessionCommand

Name Value
---- -----
PSVersion 6.0.0-beta.8
PSEdition Core
GitCommitId v6.0.0-beta.8
OS Darwin 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; ro...
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

I am not looking a alternative I need to simply connect via PSSSession like I do with W8.

All 9 comments

I just attempted

Invoke-Command -ComputerName IP.ADD.RE.SS -ScriptBlock { $env:computername } -credential administrator

and it prompted for password and then it crashed

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Management.Automation.Remoting.PrioritySendDataCollection.Clear()
   at System.Management.Automation.Remoting.Client.BaseClientTransportManager.CloseAsync()
   at System.Management.Automation.Remoting.Client.WSManClientSessionTransportManager.CloseAsync()
   at System.Management.Automation.Remoting.Client.BaseClientTransportManager.Finalize()
Abort trap: 6

So..in theory yes?

Same issue from MacOS

screen shot 2016-08-18 at 8 57 05 pm

Server side (Windows to Linux) is supported! See the OMI provider https://github.com/PowerShell/psl-omi-provider.

/cc @paulcallen

On OSX, I get:

`PS /> Invoke-command -cn winhop1.test.dev -authentication negotiate -credential (Get-Credential) -command {hostname}

cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Credential
User: vagrant
Password for user vagrant: *

Invoke-command : Unable to load DLL 'libpsrpclient': The specified module could not be found.
(Exception from HRESULT: 0x8007007E)
At line:1 char:1

  • Invoke-command -cn winhop1.test.dev -authentication negotiate -c ...
  • ~~~~~~~~~~~~~~~~~

    • CategoryInfo : NotSpecified: (:) [Invoke-Command], DllNotFoundException

    • FullyQualifiedErrorId : System.DllNotFoundException,Microsoft.PowerShell.Commands.InvokeCommandCommand`

Thanks for trying! Client side remoting (*nix to Windows) is in progress :smile:

Just echoing because I'm closing a bunch of these issues:

Per the known issues, this is not yet supported. Please follow the progress on the PSRP on Linux repo. Closing as duplicate of #942.

My command still fails is there a fix Mac->Windows ?
PS /Users/ikonstas> New-PSSession -ComputerName 10.178.228.100 -Credential administrator

PowerShell credential request
Enter your credentials.
Password for user administrator: ****

New-PSSession : MI_RESULT_ACCESS_DENIED
At line:1 char:1

  • New-PSSession -ComputerName 10.178.228.100 -Credential administrator
  • ~~~~~~~~~~~~~~~~

    • CategoryInfo : InvalidOperation: (:) [New-PSSession], PSInvalidOperationException

    • FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.NewPSSessionCommand

Name Value
---- -----
PSVersion 6.0.0-beta.8
PSEdition Core
GitCommitId v6.0.0-beta.8
OS Darwin 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; ro...
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

I am not looking a alternative I need to simply connect via PSSSession like I do with W8.

@jkonstas I believe Mac->Windows currently only supports using Basic auth.

Was this page helpful?
0 / 5 - 0 ratings