How to Manage VMware ESXi And vSphere With PowerShell

How to Manage VMware ESXi And vSphere With PowerShell

 

In this blog post, I’ll show you How to Manage VMware ESXi And vSphere With PowerShell and VMware PowrCLI

A few years ago, VMware releases their Implementation of PowerShell called PowerCLI and it allows us to deploy, manage, administrate and monitor vSphere environments using cmdlets.

PowerCLI also gives us the power to automate and script the entire lifecycle of Virtual machines, storage, networks, and users.

Last time I’ve checked PowerCLI offers more than 350 cmdlets across more than 6 modules.

You can Install the module on Windows 7 and above workstation or Windows Server 2008 R2 and above.

To get started, download the latest build from the link below and Install it on your machine.

https://www.vmware.com/support/developer/PowerCLI/

Once Installed, Start PowerCLI from the start menu

To connect, to your vSphere vCenter Center use the cmdlet below:

Connect-VIServer servername

You will be asked to enter your User name and password

In the example below, I can find out how many VMs I have on my vCenter Server by using the cmdlet below

Get-VM | measure

Below you can see all the module available with PowerCLI

To create a new Virtual Machine by cloning another VM I’ll use the line below:

New-VM -VM ExistingVM, NewVM -Location Store01 -VMHost VMHOST6

To move a Virtual machine to another host run:

Get-VM -Name VM01 | Move-VM -Destination 192.168.0.100

To get a view all the cmdlet and syntax visit the link below:

https://code.vmware.com/doc/preview?id=5591

VMware also offers another product called VMware vRealize Automation that enables us to automate the entire Infrastructure, application, and services In a Software-Defined Data center.

The product also offers cross platforms deployment between Public, private and managed clouds (Azure, AWS, VMware, etc), Containers management and anything as a Service.




Search blogs




Bitnami