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

Re: Using Powercli I having trouble modifying vm hardware and nic portgroup when deploying from template

$
0
0

So something like this below?

 

Import-Csv deploy.csv -UseCulture | %{
function UpdateVMSettings {
Write-Host "Changing Portgroup and virtual Hardware..."
Get-OSCustomizationSpec $_.Customization | -MemoryMB $_.MemoryMB -NumCpu $_.NumCpu -Confirm:$false
Get-OSCustomizationSpec $_.Customization | Get-OSCustomizationNicMapping | where { $_.Position -eq '1'} | Set-OSCustomizationNicMapping -IpMode UseStaticIP -IpAddress $_."IP Address" -SubnetMask 255.255.255.0 -DefaultGateway $_."GW" -Confirm:$false
Get-OSCustomizationSpec $_.Customization | Get-OSCustomizationNicMapping | where { $_.Position -eq '2'} | Set-OSCustomizationNicMapping -IpMode UseStaticIP -IpAddress $_."Maint IP Address" -SubnetMask 255.255.0.0 -DefaultGateway $_."GW" -Confirm:$false
Get-OSCustomizationSpec $_.Customization | Get-NetworkAdapter | Where {$_.NetworkName -eq 140 } |Set-NetworkAdapter -NetworkName $VLAN -Confirm:$false
}
$vm=New-VM -Name $_."Server Name" -Template $_.Template -Host $_."Esx Host" `
-Datastore $_.Datastore -OSCustomizationSpec $_.Customization `
-Confirm:$false -RunAsync
}

 

Message was edited by: imompero


Viewing all articles
Browse latest Browse all 230719

Trending Articles