SDKs and APIs 编辑
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 the Manage user interfaces.
- 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 5.
Note:
Older versions of the Remote PowerShell SDK are now deprecated. If you are using a deprecated version, the SDK stops working and you see an error message prompting you to download the current version. If this happens, download the latest Remote PowerShell SDK from the Citrix website.
How this SDK differs from the SDK for customer-managed deployments
In a Citrix DaaS 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 DaaS 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 DaaS 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.
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 recommends that you do not run 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.
- 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. Or, run your first Remote PowerShell SDK command, which prompts you for the same authentication asGet-XdAuthentication
. - 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.
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-->
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论