I am trying to apply a windows customization spec to one of the vm but after guest customization is applied the drive letter order is changing.
sysprep execution is causing the issue but is there any way to prevent drive letters changing during SysPrep.
Are you using the OSCustomizationSpec or a "real" sysprep file?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yeah I am using OSCustomizationSpec
Like this
$WindowsClone=New-OSCustomizationSpec -Name Vin01 -Workgroup W -OSType Windows -NamingScheme vm -ChangeSid -AdminPassword 'password' -FullName TEST01 -OrgName Testorg
Set-VM -VM TestVin01 -OSCustomizationSpec $WindowsClone -Confirm:$false
Start-VM -vm TestVin01
Are these 2 disks on separate VMDK?
Are they connected to the same SCSI Controller?
Is the order of SCSI-id of the disks corresponding with the drive letters you see being assigned?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Are these 2 disks on separate VMDK?
Yes two disks are separate VMDK but from the same lun
Are they connected to the same SCSI Controller?
Yes.
Is the order of SCSI-id of the disks corresponding with the drive letters you see being assigned?
Yes
The below status is after guest customization done
That seems to be the "normal" way that Windows assigns drive letters to the disk partitions.
Was the drive letter assignment different before the OSCustomizationSpec was applied?
If yes, did you assign those drive letters from a script or manually?
What were those drive letters? In other words what changed?
Don't forget that using an OSCustomizationSpec is like deploying a new guest OS, in which the Windows OS assigns the drive letters.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
That seems to be the "normal" way that Windows assigns drive letters to the disk partitions.
Yes understood.
Was the drive letter assignment different before the OSCustomizationSpec was applied?
Yes it is different (E drive is disk drive and D drive is CD drive)
After guest Customization D drive is disk drive and E drive is CD drive. I believe this is the normal behavior of windows once the sysprep is done it will reassign the drive letters and the last letter in the order would be cd drive.
If yes, did you assign those drive letters from a script or manually?
They are manually assigned.
So is there any way to preserve the existing drive letter configuration or preventing drive letters change during SysPrep
Afaik not with the OSCustomizationSpec and it's cmdlets.
But the underlying API method CustomizeVM and its parameter, the CustomizationSysprepText object, allows you to feed a sysprep.inf into your customisationspec.
With a sysprep.inf (aka unattend.txt) you can define drive letters.
Stephane wrote a post about that, see How to deploy a vm using powercli and unattend.xml file
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference