-KeepPreparationVMOnFailure parameter on New-ProvScheme and Publish-ProvMasterVMImage is available in Citrix DaaS, and in CVAD on-prem 2411 CR and later.Get-ProvImagePrepVM and Remove-ProvImagePrepVM cmdlets are available in Citrix DaaS; for CVAD on-prem they are planned for 2611 CR (and later).-KeepPreparationVMOnFailure but not the Get-ProvImagePrepVM / Remove-ProvImagePrepVM cmdlets, you can still keep the image preparation VM on failure, but you must locate and remove it manually from the hypervisor.Get-ProvImagePrepVM requires the View Machine Catalogs delegated-administration permission — the same read-level permission as Get-ProvVM and Get-ProvScheme. Running Remove-ProvImagePrepVM requires the Delete Machine Catalog permission — the same as Remove-ProvVM and Remove-ProvScheme. Both permissions are included in the built-in Machine Catalog Administrator and Full Administrator roles, are the same in Citrix DaaS and CVAD on-prem, and can be scoped to specific catalogs. You will also need the corresponding hypervisor-side access to inspect the retained VM — for example, rights to detach disks and to boot the VM or download/attach its OS disk.Image preparation is an important step as part of creating a machine catalog or updating the master image used by a machine catalog. It involves making a copy of the master image and performing a series of operations needed for Machine Creation Services (MCS) to be able to use that prepared image to create additional VMs. In a typical scenario, the results of image preparation are sent back to MCS. This allows MCS to interpret the results, and in failure cases, an appropriate error message can be shown in Studio (or Powershell). The image preparation VM and associated resources are typically removed after the image preparation process is completed.
This feature is available in Powershell as an optional parameter (-KeepPreparationVMOnFailure) to the New-ProvScheme and Publish-ProvMasterVMImage cmdlets.
The behavior is as follows:
How do I enable it?
Add the -KeepPreparationVMOnFailure parameter when creating a catalog or updating its master image.
Create a machine catalog:New-ProvScheme -ProvisioningSchemeName "MyCatalog" -MasterImageVM <snapshot> -KeepPreparationVMOnFailure
Update the master image of an existing catalog:Publish-ProvMasterVMImage -ProvisioningSchemeName "MyCatalog" -MasterImageVM <snapshot> -KeepPreparationVMOnFailure
For complete, ready-to-run examples, see the Citrix MCS SDK samples on GitHub for VMware and XenServer. The -KeepPreparationVMOnFailure parameter and the Get-ProvImagePrepVM / Remove-ProvImagePrepVM cmdlets work the same way on every hypervisor, so these samples apply to the other hypervisors too — only the master-image and hosting-specific parameters differ.
When is the image preparation VM kept? The VM is retained only when image preparation itself fails and the feature is enabled:
Image preparation includes running many steps on a temporary virtual machine with a VDA installed on it. There are many different options that can be specified during machine catalog creation, and as a result, a lot of different types of issues can occur. Sometimes, when failures occur, the image preparation results reported back to MCS are able to be shown in Studio (or Powershell). Other times, the failure may simply state that no VDA is installed. This happens when MCS is unable to retrieve the image preparation results from the image preparation VM. When failures occur, it may not be clear what happened, and sometimes the only way to determine the root cause is to inspect the logs on the image preparation VM. This feature introduces the ability to keep the image preparation VM on the hypervisor so that these logs can be inspected. If image preparation is successful, then the resources are removed automatically.
What is left on the hypervisor when using this feature?
At minimum, the image preparation virtual machine will be there. Other resources that may be present will vary from one hypervisor to the next. The list of resources may include one or more of the following: virtual machine, network interface, and OS disk. Optional features may also impact what resources may be present. For example, when using MCS I/O (write back cache), there will be an additional disk on the hypervisor. For some cloud-based hypervisors, the specific SKU may also determine the resources kept on the hypervisor as well.
Caution: the retained image preparation VM is a full copy of your master image, and its OS disk (and the identity disk) may contain sensitive contents. Treat these resources as sensitive and remove them promptly once you have finished collecting the logs (see "I am finished with the image preparation VM, now what?"). On cloud hypervisors, leaving them in place also incurs ongoing cost.
Powershell (where available; see Requirements)
Use the Get-ProvImagePrepVM Powershell cmdlet. You can provide the ProvisioningSchemeName or ProvisioningSchemeUid to retrieve details for one target provisioning scheme, or not provide them to see image preparation VM information for all provisioning schemes that have it.
The output looks like this:C:\PS>Get-ProvImagePrepVM
ImagePrepVMId : test-rg/Preparati-iylir
MasterImageId : test-rg/win10-novda_OsDisk_1_976b0f797e04481390049e443fa2f989
MasterImageVM : /East US.region/image.folder/test-rg.resourcegroup/win10-novda_OsDisk_1_976b0f797e04481390049e
443fa2f989.manageddisk
PluginId : AzureRmFactory
PreparationImageName : Preparation - test-azure-fail
ProvisioningSchemeName : test-azure-fail
ProvisioningSchemeUid : a68bec0f-ab81-424b-87d6-83154a35232c
State : ErrorCreating
Depending on the hypervisor, the field indicating exactly how to find the image preparation VM may vary. The PluginId field in the output above tells you which hypervisor the provisioning scheme uses. Use the table below to match it to the right field and to know what the VM looks like in that hypervisor's own console:
|
Hypervisor (PluginId) |
Field to match in Get-ProvImagePrepVM |
Notes — what you see in the hypervisor console |
|---|---|---|
|
Azure ( |
ImagePrepVMId |
Format ResourceGroup/VMName. The VM name is shortened/normalized (for example |
|
AWS ( |
ImagePrepVMId or PreparationImageName |
|
|
GCP ( |
ImagePrepVMId |
Format projectId:region:instance-name. The instance name is sanitized for GCP (lowercased, spaces/punctuation become |
|
VMware ( |
PreparationImageName |
Format Preparation - CatalogName. Matches the vSphere VM name exactly for normal names. |
|
XenServer ( |
PreparationImageName |
Format Preparation - CatalogName. Matches the XenCenter VM name exactly. |
|
Nutanix AHV ( |
PreparationImageName |
Format Preparation - CatalogName. Matches the Prism VM name exactly. (Legacy Prism Element connections use PluginId |
|
SCVMM ( |
PreparationImageName |
Format Preparation - CatalogName. Matches the SCVMM / Hyper-V Manager VM name exactly. |
At a high level, follow the below steps, but note that the exact steps are different across hypervisors. See the Hypervisor Reference section for instructions for specific hypervisors.
C:\ProgramData\Citrix\ImagePreparation for the image preparation log — named image-prep-<timestamp>.log (older VDA versions in the master image write a static image-prep.log); there may be more than one, so use the most recent or collect them all.What to collect for a support case:
image-prep-<timestamp>.log (older VDA versions in the master image write a static image-prep.log), from C:\ProgramData\Citrix\ImagePreparation; collect the newest, or all of them if there are severalPreparationStatus.xml (from the identity disk)Get-ProvImagePrepVM)PreparationStatus.xml is the structured results file that MCS reads back from the image preparation VM's identity disk. Alongside the free-form image preparation log, it records the overall preparation status and a per-step status showing which preparation steps ran and how each one finished — usually the quickest way to pinpoint the failing step. It also includes results from any third-party preparation steps and an embedded operation log. To read it, attach the identity disk (detached earlier) to another VM as a data disk.
There are multiple options for removing the image preparation VM from the hypervisor:
Get-ProvScheme -ProvisioningSchemeName myProvScheme | Remove-ProvImagePrepVMThe image preparation VM and associated resources are considered temporary. As a result, when using this feature to preserve the image preparation VM and associated resources to assist in troubleshooting the reason for the failure, these resources will be flagged by Orphaned Resource Detection. This is an intended behavior with the goal of ensuring that customers do not forget to remove the image prep VM and resources after debugging, as forgetting to do so may incur additional monthly charges.
The exact steps for detaching the identity disk and viewing the image preparation logs depend on the type of hypervisor, which falls into one of two categories:
The steps below cover the most common hypervisors in each category. Other hypervisors of the same category follow the same approach — the concepts are identical; only the specific console actions (menu names, button labels) differ. Consult your hypervisor's own documentation for the exact console steps.
Detaching the identity disk (a small ~16 MB disk named prepare-identity) prevents the image preparation process from running again the next time the VM boots, which would overwrite the logs you are trying to collect.
prepare-identity disk, and detach it (steps for XenServer and VMware are below).XenServer
Get-ProvImagePrepVM (format: Preparation - <CatalogName>).Follow the same approach in your hypervisor's own console: locate the image preparation VM (see How do I find the image preparation VM? section), find the ~16 MB prepare-identity disk attached to it, and detach it (then delete it manually once you are finished).
The image preparation log lives in the folder C:\ProgramData\Citrix\ImagePreparation inside the image preparation VM's OS disk. The log file is named image-prep-<timestamp>.log; if the VM has been booted more than once there may be several timestamped files, so collect the most recent one (or all of them). The filename format is determined by the VDA installed in the master image — older VDA versions write a single static image-prep.log instead. How you reach the folder depends on the hypervisor category.
Make sure to follow the correct steps to detach the identity disk first (see above). Then either boot the VM and read the log from the hypervisor console, or export/mount the OS disk and read it from the filesystem. Steps for XenServer and VMware follow; other on-prem hypervisors use the same approach in their own console.
There are two options:
D:), navigate to D:\ProgramData\Citrix. If prompted with a security prompt, press ContinueFor cloud hypervisors, you do not boot the image preparation VM. Instead, export, attach, or download its OS disk to another VM (or to your local machine), mount it, and read the image preparation log from …\ProgramData\Citrix\ImagePreparation\ on the mounted drive. The steps below are for Azure; AWS and GCP follow the same pattern using their own tooling (for example, attach the OS disk to another EC2 or Compute Engine instance, or download it), then read the same path.
There are two options for retrieving image preparation logs from an image preparation operation running in Azure.
D:), navigate to D:\ProgramData\Citrix. If prompted with a security prompt, press ContinueD:), navigate to D:\ProgramData\Citrix. If prompted with a security prompt, press ContinueThis feature has been used to diagnose the following issues in the past. In each case, inspecting the logs on the retained image preparation VM (as described above) is what identified the root cause and led to the resolution.
No Image Preparation results found. There may be no suitable VDA installed, or some other serious failure in the Master VM. Image preparation failed.No Image Preparation results found. There may be no suitable VDA installed, or some other serious failure in the Master VM. Image preparation failed.Unable to proceed due to shutdown in progress.No Image Preparation results found. There may be no suitable VDA installed, or some other serious failure in the Master VM. Image preparation failed.The media is write protected.FDVDenyWriteAccess and RDVDenyWriteAccess (or set them to 0). Depending on how the policy was applied, these values may be located under either HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\FVE or HKEY_LOCAL_MACHINE\System\CurrentControlSet\Policies\Microsoft\FVENo Image Preparation results found. There may be no suitable VDA installed, or some other serious failure in the Master VM. Image preparation failed.When errors occur while creating or updating a machine catalog, it can sometimes be difficult to understand what happened and what to do to address the issue. The issue most commonly happens during the image preparation step. Usually image preparation results are shown in Web Studio (or Powershell) when performing the operation, but occasionally, the results are not able to be shown and the error is No Image Preparation results found. There may be no suitable VDA installed, or some other serious failure in the Master VM. Image preparation failed. When this happens, the next course of action is to inspect the logs on the image preparation virtual machine. However, the default behavior is that the image preparation VM is always deleted at the conclusion of provisioning scheme preparation, regardless of whether the operation was successful. A new feature is now available that introduces the ability to keep the image preparation VM if there was a failure, so that the administrator can use it to help troubleshoot image preparation failures.
https://support.citrix.com/external/article/CTX140734
https://support.citrix.com/external/article/CTX695041/citrix-daas-mcs-catalog-creation-failed.html
https://support.citrix.com/external/article/CTX202229
https://support.citrix.com/external/article/CTX214572