SDKs and APIs
Citrix DaaS Remote PowerShell SDK
The Remote PowerShell SDK automates complex and repetitive tasks. It provides the mechanism to set up and manage the Citrix DaaS (formerly Citrix Virtual Apps and Desktops service) environment without using Studio.
- Cmdlet details are provided in Citrix DaaS SDK.
- The supported modules are listed in Support and limitations. That section also lists the cmdlets that are disabled in this SDK.
- Remote PowerShell SDK is available for download in the Citrix website.
This product supports PowerShell versions 3 through 7.3.
Note:
Currently, the support for Powershell 7.4 version is in preview.
How this SDK differs from the SDK for customer-managed deployments
In a Citrix Virtual Apps and Desktops deployment that is installed and managed by customer administrators, those administrators run cmdlets and scripts in a site containing VDAs and Delivery Controllers within a common domain structure. In contrast, Citrix DaaS splits the VDAs and Controllers into a resource location and the control plane, respectively. This split means that the original Citrix Virtual Apps and Desktops PowerShell SDK does not work in a Citrix DaaS environment. It cannot cross the secure boundary from the resource location to the control plane.
The solution is the Citrix DaaS Remote PowerShell SDK. When running in the resource location, the Remote PowerShell SDK accesses the control plane as if it is local. This provides the same functionality as a single Citrix Virtual Apps and Desktops site. There is only the lowest non-visible communication layer, enhanced to work either in a single local site or in the cloud environment. The cmdlets are the same, and most existing scripts remain unchanged.
The Get-XdAuthentication
cmdlet provides the authorization to cross the secure resource location to control plane boundary. By default, Get-XdAuthentication
prompts users for CAS credentials, and must be done once per PowerShell session. Alternatively, the user can define an authentication profile using an API-access Secure Client, created in the Citrix Cloud console. In both cases, the security information persists for use in subsequent PowerShell SDK calls. If this cmdlet is not explicitly run, it is called by the first PowerShell SDK cmdlet.
Prerequisites
To use the Citrix DaaS Remote PowerShell SDK, whitelist the following URLs:
Commercial
https://accounts.cloud.com
https://[service].citrixworkspacesapi.net/[customerid]
https://[customerid].xendesktop.net:443
Japan
https://accounts.citrixcloud.jp
https://[service].citrixworkspacesapi.jp/[customerid]
https://[customerid].apps.citrixworkspacesapi.jp:443
Government
https://accounts.cloud.us
https://[service].citrixworkspacesapi.us/[customerid]
https://[customerid].xendesktop.us:443
Install and use the Remote PowerShell SDK
Requirements and considerations:
Note:
Do not install the Remote PowerShell SDK on a Citrix Cloud Connector machine. It can be installed on any domain-joined machine within the same resource location.
Citrix does not support running this SDK’s cmdlets on Cloud Connectors. The SDK’s operation does not involve the Cloud Connectors.
If you also have a Citrix Virtual Apps and Desktops deployment (in addition to the Citrix DaaS deployment), do not install the Remote PowerShell SDK on an on-premises Delivery Controller machine.
- Install Microsoft Edge WebView2.
- Ensure that PowerShell 3.0, 4.0, or 5.0 is available on the machine.
- The SDK installer downloads and installs .NET Framework 4.8 if it (or a later supported version) is not already installed.
- If the machine already has the Citrix Virtual Apps and Desktops SDK installed, remove that SDK (from Windows Programs and Features) before installing the Remote PowerShell SDK.
- For an automated environment, use the
-quiet
parameter to install the SDK without user input.
To install the Remote PowerShell SDK:
- From the download page, download the Virtual Apps and Desktops Remote PowerShell SDK.
- Install and run the SDK.
Installation logs are created in %TEMP%\CitrixLogs\CitrixPoshSdk
. Logs can help resolve installation issues.
Run the SDK on a domain-joined computer within that resource location:
- Open a PowerShell command prompt. You do not need to run as an administrator.
- If you want to use the snap-in (rather than the module), add the snap-in using the
Add-PSSnapin
(orasnp
) cmdlet. - You can explicitly authenticate by using the
Get-XdAuthentication
cmdlet. Alternatively, run your first Remote PowerShell SDK command, which prompts you for the same authentication asGet-XdAuthentication
. If you are using a proxy, you must authenticate to the proxy to be able to use theGet-XdAuthentication
cmdlet. For more information, see Use the Remote PowerShell SDK with a proxy. - To bypass the authentication prompt, you can use the
Set-XdCredentials
cmdlet to create a default authentication profile, using a Secure Client created in the Citrix Cloud console. - Continue running PowerShell SDK cmdlets or PowerShell SDK automation scripts. See an example.
To uninstall the Remote PowerShell SDK, from the Windows feature for removing or changing programs, select Citrix Virtual Apps and Desktops Remote PowerShell SDK. Right-click and select Uninstall. Follow the dialog.
Use the Remote PowerShell SDK with a proxy
If you are using a proxy, you might be unable to use the Get-xdAuthentication
cmdlet because of the proxy blocking the HTTP requests that the cmdlet makes.
There are two ways to authenticate to the proxy. You can either use the ProxyUseDefault
parameter or the ProxyUsername
and ProxyPassword
parameters:
-
The
ProxyUseDefault
parameter enables authentication to the proxy by using the default proxy credentials. For example:Get-XdAuthentication -ProxyUseDefault <!--NeedCopy-->
-
The
ProxyUsername
andProxyPassword
parameters enable authentication to the proxy within the PowerShell session. For example:$secureString = ConvertTo-SecureString -String "password" -AsPlainText -Force Get-XdAuthentication -ProxyUsername user1 -ProxyPassword $secureString <!--NeedCopy-->
Note:
You get an error if you run a command with
XDHyp:\
in the remote PowerShell SDK. To resolve this issue:
- Run a command with
Hyp
. For example:Get-HypServiceStatus
- Run a command with
XDHyp:\
. For example:Get-ChildItem XDHyp:\Connections\
Example activities
Common activities include setting up machine catalogs, applications, and users. A sample script is shown below.
$users = "xd.local\Domain Users"
$TSVDACatalogName = "TSVDA"
$TSVDADGName = "TSVDA"
$TSVDAMachineName = "xd\ds-tsvda2"
#Create TSVDA Catalog
$brokerUsers = New-BrokerUser -Name $users
$catalog = New-BrokerCatalog -Name $TSVDACatalogName -AllocationType "Random" -Description $TSVDACatalogName -PersistUserChanges "OnLocal" -ProvisioningType "Manual" -SessionSupport "MultiSession" -MachinesArePhysical $true
#Add TSVDA Machine to Catalog
$BrokeredMachine = New-BrokerMachine -MachineName $TSVDAMachineName -CatalogUid $catalog.uid
#Create new desktops & applications delivery group
$dg = New-BrokerDesktopGroup -Name $TSVDADGName -PublishedName $TSVDADGName -DesktopKind "Shared" -SessionSupport "MultiSession" -DeliveryType DesktopsAndApps -Description $TSVDADGName
#Create notepad application
New-BrokerApplication -ApplicationType HostedOnDesktop -Name "Notepad" -CommandLineExecutable "notepad.exe" -DesktopGroup $dg
#Assign users to desktops and applications
New-BrokerEntitlementPolicyRule -Name $TSVDADGName -DesktopGroupUid $dg.Uid -IncludedUsers $brokerUsers -description $TSVDADGName
New-BrokerAccessPolicyRule -Name $TSVDADGName -IncludedUserFilterEnabled $true -IncludedUsers $brokerUsers -DesktopGroupUid $dg.Uid -AllowedProtocols @("HDX","RDP")
New-BrokerAppEntitlementPolicyRule -Name $TSVDADGName -DesktopGroupUid $dg.Uid -IncludedUsers $brokerUsers -description $TSVDADGName
#Add machine to delivery group
Add-BrokerMachine -MachineName $TSVDAMachineName -DesktopGroup $dg
<!--NeedCopy-->
Support and limitations
The following operating systems are supported by the Remote PowerShell SDK:
- Windows 11
- Windows 10
- Windows 10 IoT Enterprise LTSC x32 2019
- Windows 10 IoT Enterprise LTSC x64 2019
- Windows 10 IoT Enterprise 21h1 x64
- Windows Server 2022
- Windows Server 2019
- Windows Server 2016
The following Citrix Virtual Apps and Desktops PowerShell modules are supported in this release:
- Broker
- Active Directory (AD) Identity
- Machine creation
- Configuration
- Configuration logging
- Host
- Delegated administration
- Analytics
For details about cmdlets, see Citrix Virtual Apps and Desktops SDK.
After authentication, remote access remains valid in the current PowerShell session for 24 hours. After that time, you must enter your credentials.
The Remote PowerShell SDK must be run on a computer within the resource location.
The following cmdlets are disabled in remote operations to maintain the integrity and security of the Citrix Cloud control plane.
Citrix.ADIdentity.Admin.V2:
- Copy-AcctIdentityPool
- Get-AcctDBConnection
- Get-AcctDBSchema
- Get-AcctDBVersionChangeScript
- Get-AcctInstalledDBVersion
- Remove-AcctServiceMetadata
- Reset-AcctServiceGroupMembership
- Set-AcctDBConnection
- Set-AcctServiceMetadata
- Set-AcctADAccountUserCert
- Test-AcctDBConnection
Citrix.Analytics.Admin.V1:
- Get-AnalyticsDBConnection
- Get-AnalyticsDBSchema
- Get-AnalyticsDBVersionChangeScript
- Get-AnalyticsInstalledDBVersion
- Import-AnalyticsDataDefinition
- Remove-AnalyticsServiceMetadata
- Reset-AnalyticsServiceGroupMembership
- Set-AnalyticsDBConnection
- Set-AnalyticsServiceMetadata
- Set-AnalyticsSite
- Set-AnalyticsDBConnection
Citrix.DelegatedAdmin.Admin.V1:
- Add-AdminRight
- Get-AdminDBConnection
- Get-AdminDBSchema
- Get-AdminDBVersionChangeScript
- Get-AdminInstalledDBVersion
- Import-AdminRoleConfiguration
- New-AdminAdministrator
- Remove-AdminAdministrator
- Remove-AdminAdministratorMetadata
- Remove-AdminRight
- Remove-AdminServiceMetadata
- Reset-AdminServiceGroupMembership
- Set-AdminAdministrator
- Set-AdminAdministratorMetadata
- Set-AdminDBConnection
- Set-AdminServiceMetadata
- Test-AdminDBConnection
Citrix.Broker.Admin.V2:
- Get-BrokerDBConnection
- Get-BrokerDBSchema
- Get-BrokerDBVersionChangeScript
- Get-BrokerInstalledDBVersion
- Get-BrokerLease
- Get-BrokerController
- New-BrokerMachineConfiguration
- Remove-BrokerControllerMetadata
- Remove-BrokerLease
- Remove-BrokerLeaseMetadata
- Remove-BrokerMachineConfigurationMetadata
- Remove-BrokerMachineConfiguration
- Remove-BrokerSiteMetadata
- Remove-BrokerUserFromApplication
- Reset-BrokerLicensingConnection
- Reset-BrokerServiceGroupMembership
- Set-BrokerControllerMetadata
- Set-BrokerDBConnection
- Set-BrokerLeaseMetadata
- Set-BrokerMachineConfiguration
- Set-BrokerMachineConfigurationMetadata
- Set-BrokerSiteMetadata
- Test-BrokerDBConnection
- Test-BrokerLicenseServer
- Update-BrokerBrokerLocalLeaseCache
Citrix.Configuration.Admin.V2:
- Export-ConfigFeatureTable
- Get-ConfigDBConnection
- Get-ConfigDBSchema
- Get-ConfigDBVersionChangeScript
- Get-ConfigInstalledDBVersion
- Get-ConfigServiceGroup
- Import-ConfigFeatureTable
- Register-ConfigServiceInstance
- Remove-ConfigRegisteredServiceInstanceMetadata
- Remove-ConfigServiceGroup
- Remove-ConfigServiceGroupMetadata
- Remove-ConfigServiceMetadata
- Remove-ConfigSiteMetadata
- Reset-ConfigServiceGroupMembership
- Set-ConfigDBConnection
- Set-ConfigRegisteredServiceInstance
- Set-ConfigRegisteredServiceInstanceMetadata
- Set-ConfigServiceGroupMetadata
- Set-ConfigServiceMetadata
- Set-ConfigSite
- Set-ConfigSiteMetadata
- Test-ConfigDBConnection
- Unregister-ConfigRegisteredServiceInstance
Citrix.Host.Admin.V2:
- Get-HypDBConnection
- Get-HypDBSchema
- Get-HypDBVersionChangeScript
- Get-HypInstalledDBVersion
- Remove-HypServiceMetadata
- Reset-HypServiceGroupMembership
- Set-HypDBConnection
- Set-HypServiceMetadata
- Test-HypDBConnection
Citrix.ConfigurationLogging.Admin.V1:
- Get-LogDBConnection
- Get-LogDBSchema
- Get-LogDBVersionChangeScript
- Get-LogInstalledDBVersion
- Remove-LogOperation
- Remove-LogServiceMetadata
- Remove-LogSiteMetadata
- Reset-LogDataStore
- Reset-LogServiceGroupMembership
- Set-LogDBConnection
- Set-LogServiceMetadata
- Set-LogSite
- Set-LogSiteMetadata
- Test-LogDBConnection
Citrix.MachineCreation.Admin.V2:
- Get-ProvDBConnection
- Get-ProvDBSchema
- Get-ProvDBVersionChangeScript
- Get-ProvInstalledDBVersion
- Get-ProvServiceConfigurationData
- Remove-ProvServiceConfigurationData
- Remove-ProvServiceMetadata
- Reset-ProvServiceGroupMembership
- Set-ProvDBConnection
- Set-ProvServiceMetadata
- Test-ProvDBConnection
Citrix.EnvTest.Admin.V1:
- Get-EnvTestDBConnection
- Get-EnvTestDBSchema
- Get-EnvTestDBVersionChangeScript
- Get-EnvTestInstalledDBVersion
- Remove-EnvTestServiceMetadata
- Reset-EnvTestServiceGroupMembership
- Set-EnvTestDBConnection
- Set-EnvTestServiceMetadata
- Test-EnvTestDBConnection
Citrix.Monitor.Admin.V1:
- Get-MonitorConfiguration
- Get-MonitorDBConnection
- Get-MonitorDBSchema
- Get-MonitorDBVersionChangeScript
- Get-MonitorDataStore
- Get-MonitorDataStore
- Get-MonitorInstalledDBVersion
- Remove-MonitorServiceMetadata
- Reset-MonitorDataStore
- Reset-MonitorServiceGroupMembership
- Set-MonitorConfiguration
- Set-MonitorDBConnection
- Set-MonitorServiceMetadata
- Test-MonitorDBConnection
Citrix.Storefront.Admin.V1:
- Build-SfCluster
- Get-SfClusters
- Get-SfDBConnection
- Get-SfDBSchema
- Get-SfDBVersionChangeScript
- Get-SfInstalledDBVersion
Citrix DaaS discovery module for App-V packages and servers
Citrix DaaS can deliver applications contained in App-V packages to your endpoints using either of the following methods:
- Single admin management method (accessing packages from a network share)
- Dual admin management method (accessing packages from a Microsoft App-V Management Server)
The process of registering App-V packages, Microsoft App-V Management, and Publishing Servers with the Application Library using Citrix DaaS differs slightly from registering packages using an on-premises deployment. However, the process of assigning applications to users and launching them on a user’s endpoint is identical.
The Citrix DaaS management console in Citrix Cloud cannot view files in a resource location. Also, it cannot directly discover App-V packages or Microsoft App-V servers in your infrastructure. The discovery module provides functions that discover App-V package information in your on-premises infrastructure and uploads the package information to your Citrix DaaS. Package information includes App-V packages, Microsoft App-V servers, and the apps that the packages contain.
The discovery module uses the Virtual Apps and Desktops Remote PowerShell SDK. It can discover package information from either a network share or a Microsoft App-V Management Server. You use the discovery module on a machine in your resource location.
Prerequisites for using the discovery module:
- Verify that PowerShell 3.0 or later is available on the machine.
- Verify that the Citrix Virtual Apps and Desktops Remote PowerShell SDK is installed on the machine.
- Verify that you have access to the network share containing the App-V packages.
- Verify that you have access to the server where the Citrix Cloud Connectors are installed and the Microsoft App-V Management Server is hosted.
Add App-V packages to the Application Library in Citrix Cloud
The following procedure is valid for adding App-V packages from network shares (single admin management) and adding all published App-V packages from the Microsoft App-V Management Server (dual admin management). With the dual admin management method, you must manage the added App-V packages just as you do when using the single admin management method.
-
Download the discovery module from the Citrix DaaS downloads page https://www.citrix.com/downloads/citrix-cloud/product-software/xenapp-and-xendesktop-service.html. Extract the zip file
Citrix.Cloud.AppLibrary.Admin.v1.psm1
to a convenient folder.Note:
This file is also provided on the Citrix Virtual Apps and Desktops ISO in
Support\Tools\Scripts
. You can copy it locally or reference it directly from the CD drive. -
Verify that the Virtual Apps and Desktops Remote PowerShell SDK is installed on your machine
-
Navigate to the folder containing the discovery module. In the PowerShell window, type the full path of the folder containing the discovery module and then press Enter.
-
Import the discovery module with the command
Import-Module.\Citrix.Cloud.AppLibrary.Admin.v1.psm1
. -
Add the App-V packages to the Application Library in Citrix Cloud using either of the following methods.
-
To add App-V packages from a network share, run the PowerShell cmdlet:
Import-AppVPackageToCloud
.For example:
Import-AppVPackageToCloud –PackagePath \\AppVSrv\share\Notepad++.appv
For cmdlet help, type
Get-Help Import-AppVPackageToCloud
. -
To add App-V packages from a Microsoft App-V Management Server, run the PowerShell cmdlet:
Import-AppVPackagesFromManagementServerToCloud
For example:
Import-AppVPackagesFromManagementServerToCloud –ManagementSrvFQDN AppVMngSrv.domain.local
For cmdlet help, type
Get-Help Import-AppVPackagesFromManagementServerToCloud
This command imports all published App-V packages from the Microsoft App-V Management Server to Citrix Cloud.
After adding the App-V packages to Citrix Cloud, you must manage them as you do using the single admin management method.
-
-
Sign in to Citrix Cloud. Select the target customer. After the script runs successfully, the App-V packages are added to the Application Library in Citrix Cloud.
High-level PowerShell functions
The module contains the following high-level functions that you can call from your own PowerShell script:
-
Import-AppVPackageToCloud -PackagePath <Full UNC path to App-V package>
Discovers and uploads to Citrix DaaS all the information necessary to publish applications from a single App-V Package.
-
Import-AppVPackagesFromManagementServerToCloud -ManagementSrvFQDN <FQDN of a Microsoft App-V Management Server>
Discovers the UNC paths of packages published by the Management Server and calls Import-AppVPackageToCloud for each one in turn.
Packages discovered in this way are loaded to Citrix DaaS using the single admin management method. Citrix DaaS cannot deliver packages using the dual admin management method.
-
Import-AppVDualAdminToCloud -ManagementSrvUrl <URL of a Microsoft App-V Management Server> -PublishingServerUrl <URL of a Microsoft App-V Publishing Server>
Discovers Microsoft App-V Management and Publishing Servers and imports the content to the Application Library. This cmdlet imports all the packages managed using Microsoft App-V Management Server and related information. Servers can be added and removed through PowerShell.
This cmdlet adds App-V packages in dual admin mode. Only App-V packages that are published on the Microsoft App-V Management Server, and which have AD groups added, are imported. If you make changes to the Microsoft App-V Management Server, rerun this cmdlet to synchronize the Application Library with the Microsoft App-V Management Server.
-
Remove-AppVServerFromCloud -ManagementSrvUrl <URL of a Microsoft App-V Management Server> -PublishingServerUrl <URL of a Microsoft App-V Publishing Server>
Removes the Microsoft App-V Management and Publishing Servers added to Application Library.
This cmdlet removes the specified Microsoft App-V Management and Publishing Servers, plus all the associated App-V packages.
Run the discovery module for App-V packages and servers on a domain-joined computer within that resource location. Follow the guidance in Install and use the Remote PowerShell SDK to get started. Continue running PowerShell cmdlets or scripts. See the following examples.
Example activities
Import the Citrix DaaS App-V package discovery module.
import-module "D:\Support\Tools\Scripts\Citrix.Cloud.AppLibrary.Admin.v1.psm1"
<!--NeedCopy-->
Loop through the App-V Package store directory and upload each package.
Get-ChildItem -Path "\\FileServer.domain.net\App-V Packages" -Filter *.appv |
Foreach-Object{
Import-AppVPackageToCloud -PackagePath $_.FullName
}
<!--NeedCopy-->
Discover and upload packages registered with a Microsoft App-V management server.
Import-AppVPackagesFromManagementServerToCloud -ManagementSrvFQDN AppVManagementServer.domain.net
<!--NeedCopy-->
Discover Microsoft App-V Management and Publishing Servers and add the configuration to the Application Library. This also imports all the packages managed by the Microsoft App-V Management Server in dual admin mode.
Import-AppVDualAdminCloud -ManagementSrvUrl http://AppVManagementServer.domain.net –PublishingServerUrl http://AppVManagementServer.domain.net:8001
<!--NeedCopy-->
Read the PowerShell help documentation included in the module.
Get-Help Import-AppVPackageToCloud
<!--NeedCopy-->
Limitations
- You cannot discover App-V packages on your resource location infrastructure directly from the Citrix DaaS management console in Citrix Cloud. For more information on Citrix Cloud, see the Citrix Cloud documentation.
- Citrix DaaS management console in Citrix Cloud does not have a live connection to the Microsoft App-V Management server. Changes to Packages and other configuration in the Microsoft App-V Management server are not reflected in the Citrix DaaS management console until
Import-AppVDualAdminCloud
is rerun.
Monitor Service OData API
In addition to using the Monitor functions to display historical data, you can query data using the Monitor Service’s API. Use the API to:
- Analyze historical trends for planning
- Perform detailed troubleshooting of connection and machine failures
- Extract information for feeding into other tools and processes; for example, using Microsoft Excel’s PowerPivot tables to display the data in different ways
- Build a custom user interface on top of the data that the API provides
For details, see Monitor Service OData API. To access the Monitor Service API, see Access Monitor Service data using the OData v4 endpoint in Citrix Cloud.
Citrix DaaS APIs
The Citrix DaaS APIs are available at https://developer.cloud.com/citrixworkspace/citrix-daas.
Disclaimer
This software / sample code is provided to you “AS IS” with no representations, warranties, or conditions of any kind. You may use, modify, and distribute it at your own risk. CITRIX DISCLAIMS ALL WARRANTIES WHATSOEVER, EXPRESS, IMPLIED, WRITTEN, ORAL OR STATUTORY, INCLUDING WITHOUT LIMITATION WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NONINFRINGEMENT. Without limiting the generality of the foregoing, you acknowledge and agree that (a) the software / sample code might exhibit errors, design flaws or other problems, possibly resulting in loss of data or damage to property; (b) it might not be possible to make the software / sample code fully functional; and (c) Citrix may, without notice or liability to you, cease to make available the current version and/or any future versions of the software / sample code. In no event must the software / code be used to support of ultra-hazardous activities, including but not limited to life support or blasting activities. NEITHER CITRIX NOR ITS AFFILIATES OR AGENTS WILL BE LIABLE, UNDER BREACH OF CONTRACT OR ANY OTHER THEORY OF LIABILITY, FOR ANY DAMAGES WHATSOEVER ARISING FROM USE OF THE SOFTWARE / SAMPLE CODE, INCLUDING WITHOUT LIMITATION DIRECT, SPECIAL, INCIDENTAL, PUNITIVE, CONSEQUENTIAL OR OTHER DAMAGES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. You agree to indemnify and defend Citrix against any claims arising from your use, modification, or distribution of the code.