Creating a New Virtual Machine
Hello Guys
This is my first post with Power Cli, so I'l try to show you how to create a New Virtual Machine.
Here I go!!!
- First, We have to connect to the VMware Infraestructure, If you don't have the vCenter Server installed you can use the ESXi Host.
Connect-VIServer -Server YourIpServer -User administrator@vsphere.local -Password yourpassword
- Then you need to créate a Folder for VM
Get-Folder VM
$nf=Get-Folder VM
New-Folder -Name "YourFolderName" -Location $nf
- After that you need to create a ResourcePool
$cl=Get-Cluster YourClusterName
New-ResourcePool -Name YourRpName -Location $cl
- And now we create the variables for using them for the virtual machine creation function.
$rp=Get-ResourcePool YourRpName
$ds=Get-Datastore YourDatastoreName
$fm=Get-Folder YourFolderName
$vh=Get-VMHost
Take Note: This symbol $ indicates that is a variable.
- Here we create the Virtual Machine
New-VM -Name "VMCLI" -ResourcePool $rp -Location $fm -Version v8 -Datastore YourDatastoreName -DiskGB 10 -DiskStorageFormat Thin -MemoryGB 2 -Portgroup YourPortgroupName -VMhost $vh[1]
So, I did it in my lab......
Thanks for visiting my blog!!
Share and be sociable!!!
Share and be sociable!!!
No hay comentarios:
Publicar un comentario