VMware Cloud Community
PA3CRZ
Contributor
Contributor
Jump to solution

Powershell remoting over ssh from Powershell core 7.2 to a ESX host

Hi,

I would like to be able to mount a datastore on multiple ESX hosts, and the idea was to do that from Powershell Core (7.2) from a Linux host.

Posh-SSH doesn't seem to work because it is compiled against the full .Net, instead of the .Net used fro PS Core. It looks like I can use Posh-SSH only from a windows machine.

The other way to go, as I understand it, is to use New-PSSession, but when i issue the command 

$session = New-PSSession -HostName <name_of_esx_host> -Username <name_of_user>

first, the ESX host is added to known host, then I get the prompt for my password, and then the error :

New-PSSession: [name_of_esx_host] The background process reported an error with the following message: The SSH client session has ended with error message: subsystem request failed on channel 0.

 (Service SSH was started on the ESX host...)

 

It looks like there's still something wrong on the ESX host, but I can't find what it is.

Can anyone please tell me how to do this (and please, bear in mind that ideally I would like to achieve this from a Linux machine, not from Windows...)

Thanks,

Hans

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You can have a look at PowerCLI 6.3 R1: Get-ESXCLI Why the V2?

Once you have the object return ed by Get-EsxCli, you can execute all esxcli commands.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos
7 Replies
LucD
Leadership
Leadership
Jump to solution

You would need PS to be installed on the ESXi node to be able to do PS Remoting over SSH, not to mention it currently is only documented for OpenSSH.
See PowerShell remoting over SSH


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Reply
0 Kudos
PA3CRZ
Contributor
Contributor
Jump to solution




So, if I understand correctly, my options are :

1) use Posh-SSH from Windows

2) use putty/plink from Linux

when I want to submit the esxcfg-volume command.

Correct ?

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

If you want to use esxcfg-volume, yes.

Can't you mount those datastores with esxcli storage vmfs (via the Get-EsxCli cmdlet)?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
PA3CRZ
Contributor
Contributor
Jump to solution

Possibly,

But no experience whatsoever with the Get-EsxCli commands.

To be honest, I looked at it, but didn't quite understand the command. Specifically, I want to mount

a datastore permanent, but without deleting the data on it...(Disaster/Recover testing).

Do you have a link with some code, please, so I can try to understand this method ?

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

You can have a look at PowerCLI 6.3 R1: Get-ESXCLI Why the V2?

Once you have the object return ed by Get-EsxCli, you can execute all esxcli commands.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
PA3CRZ
Contributor
Contributor
Jump to solution

Thanks !

Reply
0 Kudos