Skip to main content

Posts

Showing posts from 2013

VMware: Deploy VMs from Template using PowerCLI

Syntax : 1..<N> | Foreach {  New-VM -vmhost <ESX_HOST> -Name <VM_NAME> -Template <TEMPLATE> -Datastore <DATASTORE> [-OtherOptions]  }  Where: <N> is the number of VMs you need to deploy. <ESX_HOST> is the host where you will deploy your VMs <TEMPLATE> is the template from which your VMs will be created <DATASTORE> is the datastore that will contain your VMs [-OtherOptions] are additional options that can be used in conjunction with New-VM command. As you can see it's really basic, but New-VM cmdlet is really powerful and it has a lot of options. To go through all on New-VM options: Get-Help New-VM -Detailed Here's how I used it today for deploying 6 VMs that will be Oracle RAC nodes. Open a text editor and paste this code in it saving file with .ps1 extension. 1..2 | Foreach {  New-VM -vmhost esx1.testdomain.com -Name RAC$_ -Template OL6 -Datastore datastore1  }  3..4 | Foreach {  New-VM -vmhost esx