Citrix Virtual Apps and Desktops 2507 SDK

Switch-ProvCatalog

Introduced in: Citrix Virtual Apps and Desktop 7 2507

Switch the Catalog, Provisioning Scheme, and Machines to a new host connection, with support for rollback and resource cleanup.

Syntax

Switch-ProvCatalog
      [-BrokerCatalogUid] <Int32>
      [-CleanupSourceResources]
      [-RunAsynchronously]
      [-PurgeJobOnSuccess]
      [-Force]
      [-LoggingId <Guid>]
      [-WhatIf]
      [-Confirm]
      [<CitrixCommonParameters>]
      [<CommonParameters>]
<!--NeedCopy-->
Switch-ProvCatalog
      [-BrokerCatalogUid] <Int32>
      [-Rollback]
      [-RunAsynchronously]
      [-PurgeJobOnSuccess]
      [-Force]
      [-LoggingId <Guid>]
      [-WhatIf]
      [-Confirm]
      [<CitrixCommonParameters>]
      [<CommonParameters>]
<!--NeedCopy-->
Switch-ProvCatalog
      [-BrokerCatalogUid] <Int32>
      [-DestinationHypervisorConnectionName] <String>
      [[-DestinationHostingUnitName] <String>]
      [-CreateMasterImageAtDestination]
      [-RunAsynchronously]
      [-PurgeJobOnSuccess]
      [-Force]
      [-LoggingId <Guid>]
      [-WhatIf]
      [-Confirm]
      [<CitrixCommonParameters>]
      [<CommonParameters>]
<!--NeedCopy-->

Description

Allows you to switch the catalog to a new host connection. This starts a long-running task which will switch the catalog, its Provisioning Scheme and the Machines to the given destination host connection. The new host connection information will be updated in the MCS and Broker database. Additionally, it allows rollback and resource cleanup for the previously switched catalog.

Examples

EXAMPLE 1

Switch the catalog with broker catalog Uid 1, its ProvScheme, and ProvVMs from “SourceUnit” to “DestinationUnit”.

Switch-ProvCatalog -BrokerCatalogUid 1 -SourceHostingUnitName "SourceUnit" -DestinationHostingUnitName "DestinationUnit"
<!--NeedCopy-->

EXAMPLE 2

Rollback the catalog with broker catalog Uid 1, its ProvScheme, and ProvVMs to “SourceUnit”.

Switch-ProvCatalog -BrokerCatalogUid 1 -Rollback
<!--NeedCopy-->

EXAMPLE 3

Rollback the catalog with broker catalog Uid 1, its ProvScheme, and ProvVMs to “SourceUnit” and suppress confirmation prompt.

Switch-ProvCatalog -BrokerCatalogUid 1 -Rollback -Force
<!--NeedCopy-->

EXAMPLE 4

CleanUp the source host connection resources for the catalog with broker catalog Uid 1, if it was switched previously with the migrated base images to the destination host connection.

Switch-ProvCatalog -BrokerCatalogUid 1 -CleanupSourceResources
<!--NeedCopy-->

EXAMPLE 5

CleanUp the source host connection resources for the catalog with broker catalog Uid 1, if it was switched previously with the migrated base images to the destination host connection and suppress confirmation prompt.

Switch-ProvCatalog -BrokerCatalogUid 1 -CleanupSourceResources -Force
<!--NeedCopy-->

Parameters

-BrokerCatalogUid

The Broker Uid of the catalog to switch.

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

-DestinationHypervisorConnectionName

The name of the destination host connection.

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

-Rollback

Reverts a previous attempt to switch the host connection for a catalog.

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

-CleanupSourceResources

Clean up the source host connection resources after the switch is successful. This operation is not reversible and -Rollback cannot be performed on the catalog after this operation!

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

-RunAsynchronously

Indicates whether an identifier for the task must be returned before completion of the task. The progress of the task can be monitored using ‘Get-ProvTask’ command.

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

-Force

Suppresses prompts for confirmation before running the cmdlet with -Rollback or -CleanupSourceResources.

Type: SwitchParameter
Position: Named
Default value: None
Required: False
Accept pipeline input: True (ByPropertyName)
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

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

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

-Confirm

Prompts for confirmation before running the cmdlet with -Rollback or -CleanupSourceResources.

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

-DestinationHostingUnitName

Required only for an MCS provisioned catalog. The name of the destination hosting unit. If not provided, the first hosting unit associated with the host connection will be used.

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

-CreateMasterImageAtDestination

Create a new master image at destination hosting unit for an MCS provisioned catalog.

Type: SwitchParameter
Position: 5
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

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.
  • 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 Switch-ProvCatalog task, this is always “Switch-ProvCatalog”.
  • Status <string>: Where in its lifecycle the task is.

Notes

The cmdlet is associated with a task of type SwitchProvCatalogTask, and while active will move through the following operations (CurrentOperation field):

  • ValidatingInputs
  • SwitchProvCatalog

Only one long-running task for each catalog can be processed at a time. In the case of failure, the following errors can result:

  • CatalogNotFound: The specified catalog could not be located.
  • CatalogNotReady: The specified catalog is not in Ready state.
  • 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 various reasons.
  • WorkflowHostUnavailable: The task could not be started because the database connection is inactive.
  • CommunicationError: An error occurred while communicating with the service.
  • InvalidParameterCombination: Both PurgeJobOnSuccess and RunAsynchronously were specified. When running asynchronously, the cmdlet terminates before the job does, so it cannot clean up the completed job.
  • 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. For more details, see the Windows event logs on the controller being used or Citrix Virtual Apps and Desktops logs.
Switch-ProvCatalog