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

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

$
0
0

Something like this?

 

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    }

Viewing all articles
Browse latest Browse all 192300

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>