question

Mahmoodn-3530 avatar image
0 Votes"
Mahmoodn-3530 asked Mahmoodn-3530 answered

Linux client, a drive with the name 'WSMan' does not exist.

Hi
On a windows client, I am able to run this command

 Set-Item WSMan:\localhost\Client\TrustedHosts -Value "10.1.1.50" -force

But on an Ubuntu 20.04 with powershell 7.1, I get the following error

 PS /home/mahmood> Set-Item WSMan:\localhost\Client\TrustedHosts -Value "10.1.1.50" -force
 Set-Item: Cannot find drive. A drive with the name 'WSMan' does not exist.

Any way to fix that?


msc-operations-manager
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi , we found 2 repeat threads, so I merge them into this thread. Thanks

0 Votes 0 ·
Mahmoodn-3530 avatar image
0 Votes"
Mahmoodn-3530 answered

Hi
Thanks for the reply. In fact, I want to run a powershell script from an Ubuntu 20.20 client. In that script I want to connect to a remote windows machine and invoke some commands. For example, I want to run diskpart command.

I have no problem with running the script from a windows client (windows to windows connection), but that error is specific to linux to windows connection.

It seems that WSMan is not available on Ubuntu.


 PS /home/mahmood> Get-PSDrive
    
 Name           Used (GB)     Free (GB) Provider      Root                                  CurrentLocation
 ----           ---------     --------- --------      ----                                  ---------------
 /                  26.85        228.89 FileSystem    /                                        home/mahmood
 Alias                                  Alias
 Env                                    Environment
 Function                               Function
 Temp               26.85        228.89 FileSystem    /tmp/
 Variable                               Variable


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AlexZhu-MSFT avatar image
0 Votes"
AlexZhu-MSFT answered AlexZhu-MSFT commented

Hi,

Do you want an interactive shell login? If so, why not ssh from the windows computer directly? For example, ssh -l <username> <linux_host>

98840-ssh-from-win10.png

Note: SSH client is part of windows 10 now. If it is not available, try the following PS cmdlet to get it.

Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0

It seems WSMan is not currently supported by CentOS/Ubuntu now. We can use the get-psdrive to confirm this. So, the error message above is expected behavior.

get-psdrive (linux)

98941-powershell-71-linux.png

get-psdrive (windows)

98942-powershell-windows.png

Alex
If the response is helpful, please click "Accept Answer" and upvote it.



· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi,

It seems there is no update for a couple of days. May we know the current status of the problem? Or is there any other assistance we can provide?

Regards,

Alex
If the response is helpful, please click "Accept Answer" and upvote it.

0 Votes 0 ·