Citrix Virtual Apps and Desktops SDK

New-ProvImageVersion

Prepare an image version in one image definition which can be used by provisioning scheme to provisioning virtual machines.

Syntax


New-ProvImageVersion [-PreparedImageVersionNumber] <String> [-PreparedImageDefinitionName] <String> [-PreparedImageSchemeName] <String> -MasterImageVM <String> [-Description <String>] [-NoImagePreparation] [-WriteBackCacheDiskSize <Int32>] [-WriteBackCacheMemorySize <Int32>] [-Metadata <Hashtable>] [-RunAsynchronously] [-PurgeJobOnSuccess] [-LoggingId <Guid>] [-BearerToken <String>] [-TraceParent <String>] [-TraceState <String>] [-VirtualSiteId <String>] [-AdminAddress <String>] [<CommonParameters>]

New-ProvImageVersion [-PreparedImageVersionNumber] <String> [-PreparedImageDefinitionUid] <Guid> [-PreparedImageSchemeUid] <Guid> -MasterImageVM <String> [-Description <String>] [-NoImagePreparation] [-WriteBackCacheDiskSize <Int32>] [-WriteBackCacheMemorySize <Int32>] [-Metadata <Hashtable>] [-RunAsynchronously] [-PurgeJobOnSuccess] [-LoggingId <Guid>] [-BearerToken <String>] [-TraceParent <String>] [-TraceState <String>] [-VirtualSiteId <String>] [-AdminAddress <String>] [<CommonParameters>]

<!--NeedCopy-->

Detailed Description

The prepared image version can be assigned to provisioning schemes to provision virtual machines

A snapshot is used rather than a VM, so that the content of the hard disk for the image scheme can be easily determined.

As the snapshot is specified using a path into the Citrix Host Service Powershell Provider, the Citrix Host Service Powershell snap-in must also be loaded for this cmdlet to be used.

Parameters

Name Description Required? Pipeline Input Default Value
PreparedImageVersionNumber The version number of the image version to be created. true false  
PreparedImageDefinitionName The name for the image definition used for the image version. true false  
PreparedImageSchemeName The name for the image scheme used for the image version. true false  
PreparedImageDefinitionUid The identifier for the image definition used for the image version. true false  
PreparedImageSchemeUid The identifier for the image scheme used for the image version. true false  
MasterImageVM The path in the hosting unit provider to the virtual machine snapshot that will be used. This identifies the hard disk to be used and the default values for the memory and processors. This must be a path to a Snapshot item in the same hosting unit that the hosting unit name or hosting unit Uid refers to.      
Valid paths are of the format; XDHyp:\HostingUnits<HostingUnitName><path><VMName>.vm<SnapshotName>.snapshot true true (ByPropertyName)    
Description A value indicating the image version description. false false  
NoImagePreparation Gets or sets a flag indicating that Image Preparation should be disabled false false  
WriteBackCacheDiskSize The size in GB of any temporary storage disk used by the write back cache. Should be used in conjunction with WriteBackCacheMemorySize. false false  
WriteBackCacheMemorySize The size in MB of any write back cache if required. Should be used in conjunction with WriteBackCacheDiskSize. Setting RAM Cache to 0 but specifying Disk Cache effectively disables the RAM Cache. However, there will be some memory still used to allow the I/O Optimization to operate. false false  
Metadata Gets or sets metadata of the image version. false false  
RunAsynchronously Indicates whether or not the cmdlet should return before it is complete. If specified, the command returns an identifier for the task that was created. You can monitor this task using the Get-ProvTask cmdlet. false false false
PurgeJobOnSuccess Indicates that the task history will be removed from the database when the task has finished. This cannot be specified for tasks that are run asynchronously. false false false
LoggingId Specifies the identifier of the high-level operation this cmdlet call forms a part of. Citrix Studio and Director typically create high-level operations. PowerShell scripts can also wrap a series of cmdlet calls in a high-level operation by way of the Start-LogHighLevelOperation and Stop-LogHighLevelOperation cmdlets. false false  
BearerToken Specifies the bearer token assigned to the calling user false false  
TraceParent Specifies the trace parent assigned for internal diagnostic tracing use false false  
TraceState Specifies the trace state assigned for internal diagnostic tracing user false false  
VirtualSiteId Specifies the virtual site the PowerShell snap-in will connect to. false false  
AdminAddress The address of a Citrix Virtual Apps and Desktops controller the PowerShell snap-in will connect to. You can provide this as a host name or an IP address. false false Localhost. Once a value is provided by any cmdlet, this value becomes the default.

Input Type

Return Values

System.Guid

When the RunAsynchronously identifier is specified, this GUID is returned and provides the task identifier.

Notes

Only one long-running task per image version can be processed at any one time. In the case of failure, the following errors can result.

  • JobCreationFailed: The requested task could not be started.

  • DatabaseError: An error occurred in the service while attempting a database operation.

  • DatabaseNotConfigured: The operation could not be completed because the database for the service is not configured.

  • ServiceStatusInvalidDb: An error occurred in the service while attempting a database operation - communication with the database failed for for various reasons.

  • WorkflowHostUnavailable: The task could not be started because the database connection is inactive.

  • CommunicationError: An error occurred while communicating with the service.

  • PermissionDenied: The user does not have administrative rights to perform this operation.

  • ConfigurationLoggingError: The operation could not be performed because of a configuration logging error.

  • ExceptionThrown: An unexpected error occurred. To locate more details, see the Windows event logs on the controller being used or examine the XenDesktop logs.

  • UnsupportedByServer: The requested operation is not supported by this version of the service. The cmdlet is associated with a task of type NewImageVersion, and while active will move through the following operations (CurrentOperation field)

  • ValidatingInputs: ConsolidatingMasterImage

  • PreparingMasterImage: ReplicatingMasterImage CommittingScheme

Examples

Example 1


c:\PS>New-ProvImageVersion -PreparedImageVersionNumber 1 -PreparedImageDefinitionName myImage -PreparedImageSchemeName myImageScheme -MasterImageVM XDHyp:\H

            stingUnits\HostUnit1\RhoneCC_baseXP.vm\base.snapshot -RunAsynchronously

            Guid

            ----

            0828571f-d6c2-4795-bd47-7e58b6586f34

            c:\PS>get-provtask -TaskId 0828571f-d6c2-4795-bd47-7e58b6586f34

            TaskId                     : 0828571f-d6c2-4795-bd47-7e58b6586f34

            Active                     : True

            Host                       : E70972-42-1

            DateStarted                : 4/2/2022 2:57:21 AM

            Metadata                   : {}

            Type                       : NewImageVersion

            Status                     : Running

            CurrentOperation           : PreparingMasterImage

            TaskExpectedCompletion     :

            LastUpdateTime             : 4/2/2022 2:57:42 AM

            ActiveElapsedTime          : 21

            DateFinished               :

            TerminatingError           :

            Storage                    : {}

            WorkflowStatus             : Running

            Warnings                   : {}

            ImageStatus                :

            PreparedImageVersionNumber : 1

            PreparedImageVersionUid    : b1c7602c-b080-4a63-846b-9d2429d54bd1

            PreparedImageDefinitionName: myImage

            PreparedImageDefinitionUid : 42bd09f5-3fac-44a6-8b1c-7c09f1079cc0

            PreparedImageSchemeName    : myImageScheme

            PreparedImageSchemeUid     : 53ed79c3-c771-4114-ba05-b999a62a836f

            HostingUnitUid             : 0be23759-e276-4657-b863-e958a716cb6e

            CustomProperties           :

            AdditionalCustomProperties :

            InitialBatchSizeHint       : 1

            TaskState                  : ImagePreparationInitialization

            TaskStateInformation       : ImageDefinitionName:/East US.region/image.folder/hu.resourcegroup/vda-snapshot.snapshot, StoragePath:, HostingUnitName:hu

            TaskProgress               :

            WriteBackCacheDiskSize     : 0

            WriteBackCacheMemorySize   : 0

            Scopes                     : ??

            NetworkMaps                : {0}

            ServiceOffering            : serviceoffering.folder\Standard_B2ms.serviceoffering

            StatusMessageSubstitutions :

<!--NeedCopy-->

Description

Prepares a new master hard disk image for the myImage version 1 using the “base.snapshot” hard disk image.

New-ProvImageVersion