Citrix Virtual Apps and Desktops SDK

Copy-ProvScheme

Introduced in: Citrix Virtual Apps and Desktop 7 2511

Clone a provisioning scheme

Syntax

Copy-ProvScheme
    [-SourceProvisioningSchemeName] <String>
    -TargetProvisioningSchemeName <String>
    [-TargetLocation <String>]
    [-RunAsynchronously]
    [-PurgeJobOnSuccess]
    [-LoggingId <Guid>]
    [<CitrixCommonParameters>]
    [<CommonParameters>]
<!--NeedCopy-->
Copy-ProvScheme
    [-SourceProvisioningSchemeUid] <Guid>
    -TargetProvisioningSchemeName <String>
    [-TargetLocation <String>]
    [-RunAsynchronously]
    [-PurgeJobOnSuccess]
    [-LoggingId <Guid>]
    [<CitrixCommonParameters>]
    [<CommonParameters>]
<!--NeedCopy-->

Description

Allows you to make a copy of an existing provisioning scheme

Examples

EXAMPLE 1

Make a copy of provisioning scheme Catalog-1

Copy-ProvScheme -SourceProvisioningSchemeName Catalog-1 -TargetProvisioningSchemeName CopyCatalog-1

TaskId                       : 02693f9c-8fa0-41c8-ab23-15853537fbb1
Active                       : False
Host                         : E73755-92-1
DateStarted                  : 3/24/2025 5:26:57 PM
Metadata                     : {}
SourceProvisioningSchemeUid  : a9e66277-a73e-4d4d-a6d1-748c2734501b
TargetProvisioningSchemeName : CopyCatalog-1
TargetProvisioningSchemeUid  : ec17da55-f8c4-400a-935f-46c8f2b2da2d
TargetLocation               :
TaskState                    : Finished
TaskType                     : CopyProvisioningScheme
LastUpdateTime               : 3/24/2025 5:27:15 PM
CurrentOperation             :
TerminatingError             :
TaskProgress                 : 100
WorkFlowStatus               : Completed
DateFinished                 : 3/24/2025 5:27:15 PM
TaskExpectedCompletion       : 3/24/2025 5:27:15 PM
ActiveElapsedTime            : 18
Status                       : Finished
TaskStateInformation         : Completed
Type                         : CopyProvisioningScheme
<!--NeedCopy-->

EXAMPLE 2

Make a copy of provisioning scheme Catalog-1. Create resources at the target location TestRg

Copy-ProvScheme -SourceProvisioningSchemeName Catalog-2 -TargetProvisioningSchemeName CopyCatalog-2 -TargetLocation "TestRg"

TaskId                       : 02693f9c-8fa0-41c8-ab23-15853537fbb1
Active                       : False
Host                         : E73755-92-1
DateStarted                  : 3/24/2025 5:26:57 PM
Metadata                     : {}
SourceProvisioningSchemeUid  : a9e66277-a73e-4d4d-a6d1-748c2734501b
TargetProvisioningSchemeName : CopyCatalog-1
TargetProvisioningSchemeUid  : ec17da55-f8c4-400a-935f-46c8f2b2da2d
TargetLocation               : TestRg
TaskState                    : Finished
TaskType                     : CopyProvisioningScheme
LastUpdateTime               : 3/24/2025 5:27:15 PM
CurrentOperation             :
TerminatingError             :
TaskProgress                 : 100
WorkFlowStatus               : Completed
DateFinished                 : 3/24/2025 5:27:15 PM
TaskExpectedCompletion       : 3/24/2025 5:27:15 PM
ActiveElapsedTime            : 18
Status                       : Finished
TaskStateInformation         : Completed
Type                         : CopyProvisioningScheme
<!--NeedCopy-->

Parameters

-TargetProvisioningSchemeName

The name of the provisioning scheme to be created.

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

-SourceProvisioningSchemeName

The name of the source provisioning scheme.

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

-SourceProvisioningSchemeUid

The unique identifier of the source provisioning scheme.

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

-TargetLocation

The location of the provisioning scheme to be created.

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

-RunAsynchronously

Indicates whether the command returns before it completes. If this is specified, the command returns an identifier for the task that was created. This task can be monitored using the Get-ProvTask command.

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

-PurgeJobOnSuccess

Indicates that the task history is removed from the database when the task completes. This cannot be specified for tasks that run asynchronously.

Type: SwitchParameter
Position: Named
Default value: None
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, -SkipCertificateValidation, -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

Guid

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

System.Management.Automation.PSCustomObject

This object provides details of the task that was run and contains the following information:

TaskId <Guid> The identifier for the task that was performed.

Active <bool> 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 <Citrix.MachineCreation.Sdk.Metadata[]> The list of metadata stored for the task. For new tasks, this is empty until metadata is added.

Status <string> Where in its lifecycle the task is.

SourceProvisioningSchemeUid <Guid> The unique identifier of the provisioning scheme to be copied.

TargetProvisioningSchemeName <string> The name of the provisioning scheme to be created.

TargetProvisioningSchemeUid <Guid> The unique identifier of the provisioning scheme to be created.

TargetLocation <string> Where the new provisioning scheme to be created.

CurrentOperation <string> Operation specific phase of the overall “Running” task state.

TaskProgress <double> The progress of the task 0-100%.

LastUpdateTime <DateTime> The date and time of the last task status update.

ActiveElapsedTime <int> Number of seconds the task has taken for active execution.

DateFinished <DateTime> The date and time when the task was completed.

TerminatingError < Citrix.Fma.Sdk.ServiceCore.CommonCmdlets.TaskterminatingError> Diagnostic information if the task completely fails.

Type <Citrix.XDInterServiceTypes.JobType> The type of task. For move vm disks task, this is always “Move-ProvVMDisk”.

TaskState <Citrix.DesktopUpdateManager.SDK.ProvisionVMState> The state of the task. This can be any of the following:

Processing Indicates that the task is in its initial state. LocatingResources, Indicates that the task is locating information from other services. HostingUnitNotFound Indicates that the required hosting unit could not be located. ProvisioningSchemeNotFound Indicates that the required provisioning scheme could not be located. Provisioning Indicates that the task is at the provisioning stage. IdentityPoolNotFound Indicates that the required identity pool could not be located. TaskAlreadyRunningForProvisioningScheme Indicates that the provisioning scheme already has another task running. Finalizing Indicates that the task is finalizing. Finished Indicates that the task is complete. FinishedWithErrors Indicates that the task is complete but there were errors. Specific details of errors are included with each failed virtual machine. Removing Indicates that the task is removing virtual machines from the hypervisor. Failed Job failed for reasons specified in TaskStateInformation. Canceled Indicates that the task was stopped by user intervention (using Stop-ProvTask)

TaskStateInformation <string> Provides more detailed information about the current task state.

WorkflowStatus <System.Workflow.Runtime.WorkflowStatus> Indicates the status of the workflow that is used to process the task.

TaskExpectedCompletion <DateTime> The date and time at which the task is expected to complete.

Notes

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

Error Codes


ProvisioningSchemeNotFound The specified provisioning scheme could not be located.

ProvisioningSchemeNotReady The specified provisioning scheme is not in Ready state.

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.

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

ExceptionThrown An unexpected error occurred. For more details, see the Windows event logs on the controller being used, or Citrix Virtual Apps and Desktops logs.

Copy-ProvScheme