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

Re: CreateCustomizationSpec

$
0
0

Try something like this

 

$specMgr=Get-ViewCustomizationSpecManager

$item=New-ObjectVMware.Vim.CustomizationSpecItem

$item.Info=New-ObjectVMware.Vim.CustomizationSpecInfo
$item.Info.Name="TestMultNICSDKLinux"
$item.Info.Description="Testing with the SDK method"
$item.Info.Type="Linux"

$item.Spec=New-ObjectVMware.Vim.CustomizationSpec

$item.Spec.globalIPSettings=New-ObjectVMware.Vim.CustomizationGlobalIPSettings

$item.Spec.identity=New-ObjectVMware.Vim.CustomizationLinuxPrep
$item.Spec.identity.domain="mydomain.org"
$item.Spec.identity.hostname=New-ObjectVMware.Vim.CustomizationVirtualMachineName
$item.Spec.identity.hwClockUTC=$true
$item.Spec.identity.timeZone=

$item.Spec.Options=New-ObjectVMware.Vim.CustomizationLinuxOptions

1..2|%{
 
$nic=New-ObjectVMware.Vim.CustomizationAdapterMapping
 
$nic.Adapter=New-ObjectVMware.Vim.CustomizationIPSettings
 
$nic.Adapter.ip=New-ObjectVMware.Vim.CustomizationFixedIp
 
$nic.Adapter.ip.ipAddress="192.168.1.$_"
 
$nic.Adapter.subnetMask="255.255.255.0"
 
if($_-eq1){
   
$nic.Adapter.Gateway="192.168.1.254"
  }
 
$item.Spec.nicSettingMap+=$nic
}

$specMgr.CreateCustomizationSpec($item)

Notice that the script will only assign a Gateway for the first NIC


Viewing all articles
Browse latest Browse all 230663

Trending Articles



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