VMware Cloud Community
idenjoe
Contributor
Contributor

Problem with ssh servers and PowerCLI

Hi,

I'm trying to use SSH to launch some powerCLI script that i need to run. I tried different ssh servers, and i have noticed that there are some differences that i cannot understand. The first what i do in a script is loading the snapin for powerCLI(th add-pssnapin.ps1 that is included in the extra's folder with powercli). So if i try it with WinSSHd it works fine and load the snapins, but if i try to run it with OpenSSHD or freeSSHD it didn't works. The problem is that with this ones, powershell cannot find "HKLM:\Software\VMWare, Inc.\VMWare VDM". I tried to connect trough ssh and load the single snapin from powershell(opening powershell after i have connected through ssh), but with OpenSSH and freeSSH this path doesn't exist. My question is why is it happening with OpenSSH and freeSSH , and it doesn't with WinSSH??

Regards

Reply
0 Kudos
6 Replies
idenjoe
Contributor
Contributor

Ok, now i know why is it happening. When you launch from cmd the powershell, it launches the 32-bit version of it. So how can i launch from cmd the 64-bit version of powershell???

Regards.

Reply
0 Kudos
RvdNieuwendijk
Leadership
Leadership

If you run %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe you will run the 64-bit version of PowerShell.

If you run %SystemRoot%\sysWOW64\WindowsPowerShell\v1.0\powershell.exe you will run the 32-bit version of PowerShell.

Assuming that you are running PowerShell on a 64-bit OS.

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
Reply
0 Kudos
idenjoe
Contributor
Contributor

I'm running a 2008 server 64-bit. But if i launch from a cmd 32bit this: %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe it launch the 32 bit of powershell. Is it possible to run the 64 bits version of powershell from a cmd 32bit???

Regards.

Reply
0 Kudos
RvdNieuwendijk
Leadership
Leadership

Afaik it is not possible to start 64-bit PowerShell from a 32-bit cmd.exe. You will have to use the 64-bit cmd.exe to start the 64-bit PowerShell.

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
Reply
0 Kudos
idenjoe
Contributor
Contributor

The problem with that is that the cmd is openned from the ssh server(32bits), and i don't know any ssh server builded in 64bits(except WinSSH, but i'm trying to use a free alternative).

Any idea???

Regards.

Reply
0 Kudos
RvdNieuwendijk
Leadership
Leadership

Maybe you can use MobaSSH. It seems to have a 64-bit server version.

But have you looked at PowerShell Remoting? That is a feature of PowerShell to run PowerShell commands on remote machines. It might be a better solution for your problem.

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
Reply
0 Kudos