Creating VM using PowerCLI

A quick post to build multiple VM’s using PowerCLI

Import-Csv “D:Scriptsvm.csv” -UseCulture | %{
Get-OSCustomizationSpec $_.Customization | Get-OSCustomizationNicMapping |`
Set-OSCustomizationNicMapping -IpMode UseStaticIP -IpAddress $_.”IP” `
-SubnetMask $_.SM -DefaultGateway $_.DG -Dns $_.DNS
$vm=New-VM -Name $_.”VM” -Template $_.Template -Host $_.”ESX” `
-Datastore $_.Datastore -OSCustomizationSpec $_.Customization -Confirm $False-RunAsync:)

Input of the CSV file is as below

csvEnjoy 🙂


One Response to“Creating VM using PowerCLI”

  1. October 21, 2013 at 5:31 PM #

    Coool…. Useful script to setup new project or DC

You must be logged in to post a comment.

Proudly powered by WordPress   Premium Style Theme by