Manage Vmware ESxi via PowerShell

      Comments Off on Manage Vmware ESxi via PowerShell


In my company we are use for Virtualize the servers the VmWare Esxi server. I recomand for everyone who what to use in the real PRODUCTION for litte server farms (some 10-20 servers)

But today i what to write about how can you manage via power shell this Virtual Enviroment and the Server itself.


1. You are need a installed VmWare Esxi 4 server (In my case the 4 version)

2. The VMware vSphere PowerCLI – this is the PowerShell Add-On

3. Some time.

Let’s start

1. If you have the VmWare Esxi server m you need to create a nem user, its for your safety. I dont recomand the root user. Like in this way:

–  Open the VmWare VSphere Client, go to Users & Groups, add the new user like tester and osme password. Add to the users group and on The Permisions tab define the Read Only

2. Download and install the VMware vSphere PowerCLI, its easy with the Next, Next

3. Open the newly installed shell, or run Start-> All Programs -> Vmware -> VMware vSphere PowerCLI

4. Let’s start.


For beginners
1. Get the help CHM help. This command opens a CHM file.
[code lang=”bash”]

2 Get the VI commands
[code lang=”bash”]

3. Connect to VmWare Server ( is the Server IP and the tester user is the created use on )
[code lang=”bash”]
Connect-VIServer -Server -User tester -Password abcdefgh

For Andvance users
4. Get the Storage Statisctics and all Virtual Machines infos with POWERON status
[code lang=”bash”]
$srv= Connect-VIServer -Server tester-Password abcdefgh
$storage = Get-Datastore -Server $srv

$vm_name = Get-VM -Server $srv | Sort-Object “PowerState” -Descending | Where-Object { $_.PowerState -eq “PoweredOn” } | Select-Object “Name”,”MemoryMB”,”NetworkAdapters”,”HardDisks”,”PowerState”

Write-Output “Storage Status:” $storage

Write-Output “`nVirtual Maschine infos:” $vm_name


The result:



1. VmWare Esxi 4.0

2. VMware vSphere PowerCLI