Citrix Daas SDK

New-ProvImageVersionSpec

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

Syntax

New-ProvImageVersionSpec
   -SourceImageVersionSpecUid <Guid>
   [-VMCpuCount <Int32>]
   [-VMMemoryMB <Int32>]
   -NetworkMapping <Hashtable>
   [-ServiceOffering <String>]
   [-CustomProperties <String>]
   [-MachineProfile <String>]
   [-Metadata <Hashtable>]
   [-RunAsynchronously]
   [-PurgeJobOnSuccess]
   [-LoggingId <Guid>]
   [<CitrixCommonParameters>]
   [<CommonParameters>]
<!--NeedCopy-->

Description

The prepared image version spec 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.

Examples

EXAMPLE 1

Create a prepared image version spec.

New-ProvImageVersionSpec -NetworkMapping @{"0" = "XDHyp:\HostingUnits\azure\\virtualprivatecloud.folder\East US.region\virtualprivatecloud.folder\rg.resourcegroup\vpc.virtualprivatecloud\network.network" } -ServiceOffering "XDHyp:\HostingUnits\azure\serviceoffering.folder\Standard_B2s.serviceoffering" -SourceImageVersionSpecUid f80ede4d-4c43-4acc-8181-468af5f014f7 -RunAsynchronously

TaskId                    : dec22eae-3230-40cf-b4a0-4e365a937da4
Active                    : True
Host                      : E73178-22-1
DateStarted               : 11/9/2023 8:30:01 AM
Metadata                  : {}
ImageVersionSpecUid       : 20d7319f-56f2-4152-af26-1c5e131c39e4
SourceImageVersionSpecUid : 89ecc443-8c95-49a3-8768-7ec833f61dee
ImageDefinitionName       : imgdefa
ImageDefinitionUid        : 88808fdc-7364-461d-a5ff-7e855054c4ff
ImageVersionNumber        : 1
ImageVersionUid           : d78d0d20-4cd9-405a-9ea1-d7dc5c2b5156
MasterImage               : /image.folder/rg.resourcegroup/VDA-2305-Snapshot.snapshot
DiskSize                  : 32
MachineProfile            :
HostingUnitName           : azure
HostingUnitUid            : d6041fcc-d98f-4b93-bd19-f19b535eeb24
CustomProperties          :
Scopes                    :
NetworkMaps               : {0}
ServiceOffering           : serviceoffering.folder\Standard_B2s.serviceoffering
Storage                   : {Implicit Storage}
Warnings                  :
TaskState                 : LocatingResources
TaskType                  : NewProvImageVersionSpec
LastUpdateTime            : 11/9/2023 8:30:01 AM
CurrentOperation          : ValidatingInputs
TerminatingError          :
TaskProgress              : 0
WorkflowStatus            : Running
DateFinished              : 1/1/0001 12:00:00 AM
TaskExpectedCompletion    :
ActiveElapsedTime         : 0
Status                    : Running
TaskStateInformation      : LocatingResources
Type                      : NewProvImageVersionSpec
<!--NeedCopy-->

Parameters

-SourceImageVersionSpecUid

The identifier for the source image version spec.

Type: Guid
Position: Named
Default value: None
Required: True
Accept pipeline input: False
Accept wildcard characters: False

-NetworkMapping

Specifies how the attached NICs are mapped to networks.

Type: Hashtable
Position: Named
Default value: None
Required: True
Accept pipeline input: False
Accept wildcard characters: False

-VMCpuCount

The number of processors used by virtual machines created from the image scheme.

Type: Int32
Position: Named
Default value: The number of CPUs assigned to the base image VM snapshot or VM template.
Required: False
Accept pipeline input: False
Accept wildcard characters: False

-VMMemoryMB

The maximum amount of memory used by virtual machines created from the image scheme.

Type: Int32
Position: Named
Default value: The amount of memory assigned to the base image VM snapshot or VM template.
Required: False
Accept pipeline input: False
Accept wildcard characters: False

-ServiceOffering

The Service Offering to use when creating machines in Cloud Hypervisors.

Type: String
Position: Named
Default value: None
Required: False
Accept pipeline input: False
Accept wildcard characters: False

-CustomProperties

The properties of the image version spec that are specific to the target hosting infrastructure.

Type: String
Position: Named
Default value: None
Required: False
Accept pipeline input: False
Accept wildcard characters: False

-MachineProfile

The inventory path to the source that is used as a template. This profile identifies the values for the VMs created by the catalog. This must be a path to an 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>\<snapshot>.snapshot

Type: String
Position: Named
Default value: None
Required: False
Accept pipeline input: False
Accept wildcard characters: False

-Metadata

Gets or sets metadata of the image version spec.

Type: Hashtable
Position: Named
Default value: None
Required: False
Accept pipeline input: False
Accept wildcard characters: 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.

Type: SwitchParameter
Position: Named
Default value: False
Required: False
Accept pipeline input: False
Accept wildcard characters: 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.

Type: SwitchParameter
Position: Named
Default value: False
Required: False
Accept pipeline input: False
Accept wildcard characters: 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.

Type: Guid
Position: Named
Default value: None
Required: False
Accept pipeline input: False
Accept wildcard characters: False

CitrixCommonParameters

This cmdlet supports the common Citrix parameters: -AdminAddress, -AdminClientIP, -BearerToken, -TraceParent, -TraceState and -VirtualSiteId. For more information, see about_CitrixCommonParameters.

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

None

You can’t pipe objects to this cmdlet.

Outputs

Citrix.Host.DataModel.ImageVersionSpec

This object provides details of the image instances and contains the following information:

TaskId <Guid>

The identifier for the task that was performed.

Active <Boolean>

Indicates whether the task is still processing or is complete.

Host <string>

The name of the host on which the task is running or was run.

DateStarted <DateTime>

The date and time when the task was started.

Metadata <IDictionary<string,string>>

The metadata to apply to the image version spec, if specified.

ImageVesionSpecUid <string>

The unique identifier of the image version spec that the task was for.

ImageDefinitionName <string>

The name of the image definition for which the image version spec is created.

ImageVersionNumber <string>

The version number of the image version spec that the task was for.

ImageVersionUid <Guid>

The unique identifier of the image version spec that the task was for.

HostingUnitName <string>

The name of the hosting unit (from the Hosting Unit PowerShell snap-in) that the new image version will use.

HostingUnitUid <Guid>

The unique identifier of the hosting unit (from the Hosting Unit PowerShell snap-in) that the new image version will use.

MasterImage <string>

The inventory path to the VM snapshot copy used in this image version spec.

CustomProperties <string>

The properties of the image version that are specific to the target hosting infrastructure.

DiskSize <int>

The size of the disk.

MachineProfile <string>

The inventory path to the source VM used by the scheme as a template.

NetworkMaps <Citrix.MachineCreation.DataModel.NetworkMap[]>

The NIC/network mappings that will be used to create VMs.

ServiceOffering <string>

The service offering that the scheme uses when creating VMs in Cloud Hypervisors.

Warnings <Citrix.MachineCreation.DataModel.ProvSchemeWarning[]>

Warning states that have occurred with this image version spec.

TaskType <Citrix.XDInterServiceTypes.JobType>

The type of the task. For new image version tasks this is always “NewImageVersionSpec”.

LastUpdateTime <DateTime>

The date and time of the last task status update.

CurrentOperation <string>

Operation specific phase of the overall “Running” task state.

TerminatingError <Citrix.Fma.Sdk.ServiceCore.CommonCmdlets.TaskterminatingError>

Diagnostic information if the task completely fails.

TaskProgress <double>

The progress of the task 0-100%.

WorkflowStatus <System.Workflow.Runtime.WorkflowStatus>

Indicates the status of the workflow that is used to process the task.

DateFinished <DateTime>

The date and time when the task was completed.

TaskExpectedCompletion <DateTime>

The date and time at which the task is expected to complete.

ActiveElapsedTime <int>

Number of seconds the task has taken for active execution.

Status <string>

Where in its lifecycle the task is.

TaskStateInformation <string>

Holds string data providing more details about the current task state.

Type <Citrix.XDInterServiceTypes.JobType>

The Type of the task. For new image version tasks this is always “NewImageVersion”.

TaskState <Citrix.DesktopUpdateManager.SDK.NewProvisioningSchemeState>

The state of the task. This can be any of the following:

Processing

Indicates that the task has just begun and has not done anything yet.

LocatingResources,

Indicates that the workflow is locating resources from other services.

HostingUnitNotFound

Indicates that the task failed because the required hosting unit could not be located.

VirtualMachineSnapshotNotFound

Indicates that the task failed because the required snapshot could not be located.

ConsolidatingMasterImage

Indicates that the task is consolidating the master image.

ReplicatingConsolidatedImageToAllStorage

Indicates that the task is replicating the consolidated master image.

StoringImageVersion

Indicates that the task is storing the image version data to the database.

Finished

Indicates that the task has completed with no errors.

ImageVersionSpecAlreadyExists

Indicates that the task failed because an image version spec on an image version already exists.

MasterVMImageIsNotPartOfImageDefinitionHostingUnit,

Indicates that the hosting unit that the master image originated from is not the hosting unit that the image definition is defined to use.

MasterVmImageIsNotASnapshot

Indicates that the task failed because the master VM Image path does not refer to a Snapshot item.

InvalidMasterVMConfiguration

The VM snapshot specified as the master had an invalid configuration.

InvalidMasterVMState

The VM snapshot specified as the master is currently in an invalid state.

InsufficientResources

Indicates that the task failed because the hypervisor did not have enough resources to complete the task.

StorageNotFound

Indicates that no associated storage was found in the hosting unit.

Canceled

Indicates that the task was stopped by user intervention (using Stop-ProvTask)

Notes

In the case of failure, the following errors can result.

Error Codes


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.

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.

New-ProvImageVersionSpec