Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 246801

Re: Create VM using PowerCLI and csv file

$
0
0

LucD,

 

That seems to have done it.  I do have one final question.  Is there a way to limit the amount of VMs that it attemps to create at a time, other than limiting the number that are in the CSV file?  I am concernted that we may beat the crunck out of the hosts and affect the currenlty running VMs

 

Here is the script so far.

 

## Deploy VMs from CSV File
## Much borrowed from http://communities.vmware.com/thread/315193?start=15&tstart=0

 


## Imports CSV file
Import-Csv "C:\temp\TestDeploy1" -UseCulture | %{
## Gets Customization info to set NIC to Static and assign static IP address
    Get-OSCustomizationSpec $_.Customization | Get-OSCustomizationNicMapping | `
## Sets the Static IP info
    Set-OSCustomizationNicMapping -IpMode UseStaticIP -IpAddress $_."IP Address" `
        -SubnetMask $_.Subnet -DefaultGateway $_.Gateway -Dns $_.DNS
## Sets the name of the VMs OS
    $cust = Get-OSCustomizationSpec -Name Test
    Set-OSCustomizationSpec -OSCustomizationSpec $cust -NamingScheme Fixed -NamingPrefix $_.VMName
## Creates the New VM from the template
    $vm=New-VM -Name $_."Server Name" -Template $_.Template -Host $_."Esx Host" `
        -Datastore $_.Datastore -OSCustomizationSpec $_.Customization `
        -Confirm:$false -RunAsync
## .......
}


Viewing all articles
Browse latest Browse all 246801

Trending Articles