Creating virtual machines
We will use the following cmdlets to manage the different aspects of managing a virtual machine in a vSphere environment using PowerCLI cmdlets:
Get-VM
Move-VM
New-VM
Remove-VM
Set-VM
We will start by creating a simple virtual machine. To do this, we will use the New-VM
cmdlet:
PS C:\> New-VM -Name Test3 -ResourcePool Mgmt -Datastore iSCSI-4 ` -NumCPU 1 -MemoryGB 1 -DiskGB 10 -NetworkName "VM Network" ` –Floppy -CD -DiskStorageFormat Thin -GuestID winNetDatacenterGuest Name PowerState Num CPUs MemoryGB ---- ---------- -------- -------- Test3 PoweredOff 1 1.000
The output will be as follows:
Note that the ResourcePool
parameter accepts ResourcePool
, Cluster
, VApp
, and standalone VMHost
as input options. For example, in the following screenshot, I am creating a VM directly under the cluster, Lab Cluster
:
We can use the Get-VM
cmdlet to check the list of available VMs or a particular VM:
PS...