Hi All,
new-vm -VMhost esx1 -name myNewVM -Template myTemplate -OSCustomizationSpec mySpec [deploy from tempate]
compared to:
new-vm -VMhost esx1 -name myNewVM -vm myExistingVM -OSCustomizationSpec mySpec [clone existing VM]
[1]
Will the OSCustomizationSpec apply / work correctly and in the same way if applied to either a Template or if cloning from an existing VM? If not, what are the differences / caveats ?
[2]
Why does the Set-VMGuestNetworkInterface cmdlet only support WinXP/Win2k3/RedHat5 OS (existing VM), while customizing a template supports a much larger range of OS (Windows XP/2k/2k3/Vista/2k8/7/2k8 r2/redhat 2,3,4/sles/ubuntu etc) ? What is so different about being able to change the IP of a guest when its deployed via a Template that makes it a much wider range of OS is supported?
regards
marc0
[3] It uses the sysprep to do this.
The sysprep files (binaries and the settings file) are injected into the .vmdk of the new VM.
On a poweron, the sysprep is executed and the OS of the VM is configured according to the settings.
[4] Yes, when you use an OSCustomizationSpec (which is in fact a sysprep, see [3], the VM needs to be powered on in order to let the sysprep process kick in.
Note that [3] & [4] is obviously only valid for Windows based guests.
Linux based guests use a much simpler mechanism, but are consequently rather limited in what you can customize.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
[1] Yes, there should be no difference
[2] Because the Set-VMGuestNetworkInterface cmdlet uses scripts that are run inside the guest OS. These script can be found in the %ProgramFiles%\VMware\Infrastructure\vSphere PowerCLI\Scripts folder. On newer Windows versions the ípconfig /all' and 'netsh' commands have a slightly different format and the current scripts don't handle that format yet.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks Luc,
[3]
What mechanism is used to change the IP address when applying a OSCustomizationSpec? Obviously it does not run the script inside the OS as per the Set-VMGuestNetworkInterface cmdlet, so how exactly DOES the IP address get changed when using the OSCustomizationSpec mechanism?
[4]
When applying a OSCustomizationSpec to a cloned VM (as opposed to a template), I assume the VM still needs to be started, rebooted etc for the customization to actually occur?
Regards,
marc0
[3] It uses the sysprep to do this.
The sysprep files (binaries and the settings file) are injected into the .vmdk of the new VM.
On a poweron, the sysprep is executed and the OS of the VM is configured according to the settings.
[4] Yes, when you use an OSCustomizationSpec (which is in fact a sysprep, see [3], the VM needs to be powered on in order to let the sysprep process kick in.
Note that [3] & [4] is obviously only valid for Windows based guests.
Linux based guests use a much simpler mechanism, but are consequently rather limited in what you can customize.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hello,
I am just starting to familiarize myself with this deployment method. What I'd like to do is call a saved configuration spec that contains all the standard information (reg info, licensing, domain membership/creds, etc.) and pass the NIC config via imported colums in a CSV. Is that possible?
In my first attempt, the commands actually modified the stored spec file (which clearly isn't what I'm looking for but I can see how it happened).
EX:
*****************************************************************************************************
Import-CSV C:\PowerShell\Import-CSV\IP_input\Deploy_withIP.csv | Foreach {
#
New-VM -vmhost $_.esxhost -Name $_.vmname -Template $_.templatename -Datastore $_.datastore -DiskStorageFormat thick -Location $_.folder -OSCustomizationSpec $_.customspec
Get-OSCustomizationNicMapping -spec $_.customspec | Set-OSCustomizationNicMapping -IpMode UseStaticIp -IpAddress $_.ip -SubnetMask $_.netmask -DefaultGateway $_.gw -Dns $_.dns1,$_.dns2
*****************************************************************************************************
Thanks for any help offered gentlemen!
You should work on a clone of the OSCustomization object.
You can do that with the New-OSCustomizationSpec and the OSCustomizationSpec parameter.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference