So, at times I would go to extremes to try and make something work the way I want. Now this post may not be helpful to most people. But if you ever wanted to execute powercli from your non windows machine read on.
Disclaimer: I will not recommend this for any production environment. This is just what I did in my lab to avoid the extra RDP session I would have to make to a windows machine to get to PowerCLI. If you decide to use this and find yourself in the hot seat, don’t blame me for it
First thing is first, install PowerCLI on a windows machine. Yes you will still need to install it on a windows box. As of 03/08/2012, you can download PowerCLI from here.
Once you have installed PowerCLI, do one quick thing (this is not required but it would just make things a little easier). Copy the PowerCLI shortcut from your desktop and drop it in the root of C, this will result in easy access for later. You can also mess around with the environment variables if that suits you better.
The next task is to install a SSH server on this windows machines (where you installed PowerCLI). Pick your favorite from the list below, I am sure there are more than what I listed below.
The list above is in no particular order, pick whichever one you prefer. I went with WinSSHD and the install was pretty straight forward. Once I installed WinSSHD, I took all the defaults and port 22 for ssh. I had to give a local account admin access which was pretty straight forward as well. You can also use domain accounts if you get the paid version. The only thing after adding the admin account is that you have to start the WinSSHD service from the WinSSHD control panel.
Once SSH is running on the windows machine and you have PowerCLI installed, you are all set.
Go back to your non-windows machine in my case its a MBP running Lion 10.7.3.
- Start terminal
- type “ssh username@ip/hostname” username is the same user that has ssh access and ip/hostname is of the one where you have PowerCLI and SSH server running
- You will be prompted for password, go ahead and enter that in
- You will now be looking at the command prompt of your windows box (yoohooo!)
- Remember I had you copy the PowerCLI shortcut to the root of C? Now go to the root of C and execute the shortcut to look at your fresh PowerCLI prompt on your non-windows machine
- Once you run the above file, you will be sitting at the PowerCLI prompt where you can make your connection to the vCenter
- One thing that I wanted to point out. I created a local user on my windows machine that had SSH access. This local user did not have access to vCenter. Because of this I think, when I ran Connect-VIServer vCenterServerName, nothing happened. I had at least hoped for a login prompt but nothing. So I ended up supplying the credentials in the command line and that worked.
Connect-VIServer vCenterServerName -User YourvCenterUsername -Password YourPassword
- What’s next? Well run all your PwerCLI commands from your non-windows machine. Technically you are still running it on Windows because you have SSHed into your windows box, but port 3389 can go away now as port 22 will do the job
Again, please keep in mind that this is really a do it at your own risk sort of thing. If you decide to by cowboyish, thats your own decision not mine. I will probably let this setup run for sometime in my lab to see if I find any caveats.