Manage favorites for a store
You can manage subscription data (favorites) for a store using PowerShell cmdlets.
Note:
Use either the StoreFront management console or PowerShell to manage StoreFront. Do not use both methods at the same time. Always close the StoreFront management console before using PowerShell to change your StoreFront configuration. Citrix also recommends that you take a backup of your existing subscription data before making changes so that rollback to a previous state is possible.
Purge subscription data
A folder and datastore containing subscription data exists for each store in your deployment.
- Stop the Citrix Subscriptions Store service on the StoreFront server. If the Citrix Subscriptions Store service is running, it is not possible to delete subscription data for any of your stores.
- Locate the subscription store folder on the StoreFront server:
C:\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Citrix\SubscriptionsStore\1__Citrix_<StoreName>
- Delete the contents of the subscription store folder, but do not delete the folder itself.
- Restart the Citrix Subscriptions Store service on the StoreFront server.
In StoreFront 3.5 or later, you can use the following PowerShell script to purge subscription data for a store. Run this PowerShell function as an administrator with rights to stop or start services and delete files. This PowerShell function achieves the same result as the manual steps described above.
To run the cmdlets successfully, the Citrix Subscriptions Store service must be running on the server.
function Remove-SubscriptionData
{
[CmdletBinding()]
[Parameter(Mandatory=$False)][String]$Store = "Store"
$SubsService = "Citrix Subscriptions Store"
# Path to Subscription Data in StoreFront version 2.6 or later
$SubsPath = "C:\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Citrix\SubscriptionsStore\1__Citrix_$Store\*"
Stop-Service -displayname $SubsService
Remove-Item $SubsPath -Force -Verbose
Start-Service -displayname $SubsService
Get-Service -displayname $SubsService
}
Remove-SubscriptionData -Store "YourStore"
<!--NeedCopy-->
Export subscription data
You can obtain a backup of the Store subscription data in the form of a tab separated .txt file using the following PowerShell cmdlet.
$StoreObject = Get-STFStoreService -SiteID 1 -VirtualPath "/citrix/<yourstore>"
Export-STFStoreSubscriptions -StoreService $StoreObject -FilePath "$env:USERPROFILE\Desktop\Subscriptions.txt"
If you are managing a multiple-server deployment, you can run this PowerShell cmdlet on any server within the StoreFront server group. Each server in the server group maintains an identical synced copy of the subscription data from its peers. If you believe you are experiencing issues with subscription synchronization between the Storefront servers, then export the data from all servers in the group and compare them to see differences.
Restore subscription data
Use Restore-STFStoreSubscriptions to overwrite your existing subscription data. You can restore a Store’s subscription data using the tab separated .txt file backup you created earlier using Export-STFStoreSubscriptions.
$StoreObject = Get-STFStoreService -SiteID 1 -VirtualPath "/citrix/<yourstore>"
Restore-STFStoreSubscriptions -StoreService $StoreObject -FilePath "$env:USERPROFILE\Desktop\Subscriptions.txt"
<!--NeedCopy-->
For more information on Restore-STFStoreSubscriptions, see https://developer-docs.citrix.com/en-us/storefront-powershell-sdk/2402/Restore-STFStoreSubscriptions/
Restoring Data on a Single StoreFront Server
In a single server deployment, there is no need to shut down the Subscriptions Store service. There is also no need to purge the existing subscription data before restoring the subscription data.
Restoring Data on a StoreFront Server Group
To restore subscription data to a server group, the following steps are required.
Example Server Group Deployment containing three StoreFront servers.
- StoreFrontA
- StoreFrontB
- StoreFrontC
- Back up of the existing subscription data from any of the three servers.
- Stop the Subscriptions Store service on servers StoreFrontB and C. This action prevents the servers from sending or receiving subscription data during the update of StoreFrontA.
- Purge the subscription data from servers StoreFrontB and C. This prevents mismatch of the restored subscription data.
- Restore the data on StoreFrontA using the Restore-STFStoreSubscriptions cmdlet. It is not necessary to stop the Subscriptions Store service, or to purge the subscription data on StoreFrontA (it is overwritten during the restore operation).
- Restart the Subscriptions Store service on servers StoreFrontB and StoreFrontC. The servers can then receive a copy of the data from StoreFrontA.
- Wait for synchronization to occur between all servers. The time required depends on the number of records that exist on StoreFrontA. If all servers are on a local network connection, synchronization normally occurs quickly. Synchronization of subscriptions across a WAN connection may take longer.
- Export the data from StoreFrontB and C to confirm that the synchronization has completed, or view the Store Subscription counters.
Import subscription data
Use Import-STFStoreSubscriptions when there is no subscription data for the Store. This cmdlet also allows subscription data to be transferred from one Store to another or if subscription data is imported to newly provisioned StoreFront servers.
$StoreObject = Get-STFStoreService -SiteID 1 -VirtualPath "/citrix/<yourstore>"
Import-STFStoreSubscriptions -StoreService $StoreObject -FilePath "$env:USERPROFILE\Desktop\Subscriptions.txt"
<!--NeedCopy-->
For more information on Import-STFStoreSubscriptions, see https://developer-docs.citrix.com/en-us/storefront-powershell-sdk/2402/Import-STFStoreSubscriptions/
Subscription data file details
The subscription data file is a text file containing one line per user subscription. Each line is a tab-separated sequence of values:
<user-identifier> <resource-id> <subscription-id> <subscription-status> <property-name> <property-value> <property-name> <property-value> ...
where:
-
<user-identifier>
- Required. A sequence of characters identifying the user. This identifier is the user’s Windows Security Identifier. -
<resource-id>
- Required. A sequence of characters identifying the subscribed resource. -
<subscription-id>
- Required. A sequence of characters uniquely identifying the subscription. This value is not used (although, a value must be present in the data file). -
<subscription-status>
- Required. The status of the subscription: subscribed or unsubscribed. -
<property-name>
and<property-value>
- Optional. A sequence of zero or more pairs of property name/value pairs. These represent properties associated with the subscription by a StoreFront client (typically a Citrix Workspace app). A property with multiple values that is represented by multiple name/value pairs that have the same name (for example, “… MyProp A MyProp B …” represents the property MyProp with values A, B).
Example
S-0-0-00-0000000000-0000000000-0000000000-0000 XenApp.Excel 21EC2020-3AEA-4069-A2DD-08002B30309D Subscribed dazzle:position 1
Size of subscription data on the StoreFront server disk
No of Records | Size MB |
---|---|
0 | 6.02 |
1,000 | 7.02 |
10,000 | 40.00 |
100,000 | 219.00 |
200,000 | 358.00 |
500,000 | 784.00 |
800,000 | 1213.02 |
1,000,000 | 1597.15 |
1,300,000 | 1919.15 |
1,500,000 | 2205.15 |
2,000,000 | 2915.15 |
Size of import and export .txt files
No of Records | Size MB |
---|---|
0 | 0.00 |
1,000 | 0.13 |
10,000 | 1.30 |
100,000 | 12.80 |
200,000 | 25.60 |
500,000 | 64.10 |
800,000 | 102.00 |
1,000,000 | 128.00 |
1,300,000 | 166.00 |
1,500,000 | 192.00 |
1,700,000 | 218.00 |
2,000,000 | 256.00 |
Store Subscription Counters
You can use Microsoft Windows Performance monitor counters (Start > Run > perfmon) to show, for example, the total numbers of subscription records on the server or number of records synchronized between StoreFront server groups.
View the Subscription Counters using PowerShell
Get-Counter -Counter "\Citrix Subscription Store(1__citrix_store)\Subscription Entries Count (including unpurged deleted records)"
Get-Counter -Counter "\Citrix Subscription Store Synchronization\Subscriptions Store Synchronizing"
Get-Counter -Counter "\Citrix Subscription Store Synchronization\Number Subscriptions Synchronized"
Get-Counter -Counter "\Citrix Subscription Store Synchronization\Number Subscriptions Transferred"
<!--NeedCopy-->
In this article
- Purge subscription data
- Export subscription data
- Restore subscription data
- Restoring Data on a Single StoreFront Server
- Restoring Data on a StoreFront Server Group
- Import subscription data
- Subscription data file details
- Example
- Store Subscription Counters
- View the Subscription Counters using PowerShell