We're working on a tool to automate deployment of some Linux guests which serve as proxies for our Avamar backup device. The guests run SLES.
I'm doing something like this from inside a loop (reading from a CSV file):
Get-OSCustomizationSpec $specname | Set-OSCustomizationSpec `
-NamingScheme "Fixed" -NamingPrefix $name
Get-OSCustomizationSpec $specname | Get-OSCustomizationNicMapping `
| Set-OSCustomizationNicMapping -IpAddress $ip `
-DefaultGateway $gateway -IPMode UseStaticIP `
-Subnetmask 255.255.255.0
New-VM -Name $name -Template $template -VMHost $vmhost `
-Location $target_folder -OSCustomizationSpec $specname
Get-VM -Name $name | Get-NetworkAdapter `
| Set-NetworkAdapter -NetworkName $network_name -Confirm:$false
The machines clone fine, and the output to the terminal shows the correct IP, but the machines come up with the network config that's on the template.
A couple questions:
1) Do I need to save get-oscustomizationspec to an object and reference it by that, rather than by name? I've tried doing it a few different ways.
2) Should this be working with SLES 11, or are there only certain supported OSes for guest customization?
3) Assuming $name is the name we want for the guest, is using -NamingScheme "Fixed" -NamingPrefix $name the right way to set the system's hostname to that value?
4) Do I need to wait 5-10 minutes for the system to reconfigure itself and reboot, as mentioned in Re: Creating Templates, do I use sysprep., or is that only the case for Windows guests. For what it's worth, the template was created from a VM that has working VMWare Tools.