I spoke with some people and noticed that not everyone is familiar with scripting vmware VI using powershell. I thought i would made a post with how to obtain/install what is needed to get it done.
2) download VMware-PowerCLI-4.1.1-332441.exe
3) Start installing powercli, you might encounter an error sayin that powershell 1.0 is not installed. In this case you will have to also download windows powershell. For XP O/S you can download using this url:
If you have other O/S please download the right version for you:
3)while installing powercli, you will be asked if installer can change for you the execution policy to “Remote Signed”. You should choose “Do this For Me”. If you click Continue, you will have to do this manually after installation. Execution policy is well described here:
You can always verify it by invoking cmd-let:
and set it by invoking
You can also read manual within powershell about ExecutionPolicy typing:
4)We will need some editor for our scripts(although you can write directly under powershell.exe).
You can use editor that comes with powershell – Powershell ISE, or you can try PowerGUI from http://www.powergui.org
5) I assume, that all went right, and you can start powercli console : start->programs->vmware->powercli
After powercli initializes its environment, you can test you connection to ESX/VC.
Connect-viserver without any switches will ask you after few seconfs for credentials.
If you typed user/password without issues you will see something like this:
Name Port User
—- —- —-
Esx/Vc IP 443 Logged_User
It means that you can start scripting 😉 Try some basic cmd-lets like:
get-vm / get-vmhost , try what stands behind get-cmd
That’s it for now, in next few days i will write more about powercli basics. If you have encountered any problems, let me know.