StoreFront SDK 编辑
Citrix StoreFront provides an SDK based on a number of Microsoft Windows PowerShell version 3.0 modules. With the SDK, you can perform the same tasks as you would with the StoreFront MMC console, together with tasks you cannot do with the console alone.
For the SDK Reference, see StoreFront SDK.
Key differences between the StoreFront 3.0 and current StoreFront SDK
- High-level SDK Examples - This version provides high-level SDK scripts that enable you to script and automate StoreFront deployments quickly and easily. You can tailor the high-level examples to your particular requirements enabling you to create a new deployment simply by running one script.
- New low-level SDK - Citrix provides a documented low-level StoreFront SDK enabling the configuration of deployments including stores, authentication methods, Citrix Receiver for Web and Unified Citrix Receiver sites, as well as remote access with Citrix Gateway.
- Backwards Compatibility - StoreFront 3.6 still contains the StoreFront 3.0 and earlier APIs so existing scripts can be gradually transitioned to the new SDK.
Important:
Backwards compatibility with StoreFront 3.0 has been maintained where possible and practicable. However, Citrix recommends when writing new scripts, use the new Citrix.StoreFront.* modules, as the StoreFront 3.0 SDK is deprecated and will eventually be removed.
Use the SDK
The SDK comprises of a number of PowerShell snap-ins installed automatically by the installation wizard when you install and configure various StoreFront components.
To access and run the cmdlets:
Start a shell in PowerShell 3.0.
You must run the shell or script using a member of the local administrators group on the StoreFront server.
To use SDK cmdlets within scripts, set the execution policy in PowerShell.
For more information about PowerShell execution policy, see your Microsoft documentation.
Add the modules you require into the PowerShell environment using the Add -Module command in the Windows PowerShell console. For example, type:
Import-Module Citrix.StoreFront
To import all the cmdlets, type:
Get-Module -ListAvailable | Where-Object { $_.Name.StartsWith("Citrix.StoreFront") } | Import-Module
After importing, you have access to the cmdlets and their associated help.
Get started with the SDK
To create a script, perform the following steps:
- Take one of the provided SDK examples installed by StoreFront into the %ProgramFiles%\Citrix\Receiver StoreFront\PowerShellSDK\Examples folder.
- To help you customize your own script. review the example script to understand what each part is doing. For more information, see the example use case, which explains in detail the script’s actions.
- Convert and adapt the example scripts to turn them into a script that is more consumable. To do this:
- Use the PowerShell ISE or a similar tool to edit the script.
- Use variables to assign values that are to be reused or modified.
- Remove any commands that are not required.
- Note that StoreFront cmdlets can be identified by the prefix STF.
- Use the Get-Help cmdlet supplying the cmdlet name and -Full parameter for more information on a specific command.
Examples
Note:
When creating a script, to ensure you always get the latest enhancements and fixes, Citrix recommends you follow the procedure described above rather than copying and pasting the example scripts.
Examples | Description |
---|---|
Create a Simple Deployment | Script: creates a simple deployment with a StoreFront controller configured with a single XenDesktop server. |
Create a Remote Access Deployment | Script: builds on the previous script to add remote access to the deployment. |
Create a Remote Access Deployment with Optimal Launch Gateway | Script: builds on the previous script to add preferred optimal launch gateways for a better user experience. |
Example: Create a simple deployment
The following example shows how to create a simple deployment configured with one XenDesktop controller.
Before you begin, make sure you follow the steps detailed in Get Started with the SDK. This example can be customized using the methods described to produce a script for automating StoreFront deployment.
Note:
To ensure you always get the latest enhancements and fixes, Citrix recommends you follow the procedure described in this document, rather than copying and pasting the example script.
Understand the script
This section explains what each part of the script produced by StoreFront is doing. This will help you with the customization of your own script.
Sets the error handling requirements and imports the required StoreFront modules. Imports are not required in newer versions of PowerShell.
Param( [Parameter(Mandatory=$true)] [Uri]$HostbaseUrl, [long]$SiteId = 1, [ValidateSet("XenDesktop","XenApp","AppController","VDIinaBox")] [string]$Farmtype = "XenDesktop", [Parameter(Mandatory=$true)] [string[]]$FarmServers, [string]$StoreVirtualPath = "/Citrix/Store", [bool]$LoadbalanceServers = $false, [int]$Port = 80, [int]$SSLRelayPort = 443, [ValidateSet("HTTP","HTTPS","SSL")] [string]$TransportType = "HTTP" ) \# Import StoreFront modules. Required for versions of PowerShell earlier than 3.0 that do not support autoloading Import-Module Citrix.StoreFront Import-Module Citrix.StoreFront.Stores Import-Module Citrix.StoreFront.Authentication Import-Module Citrix.StoreFront.WebReceiver <!--NeedCopy-->
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论