Fetching contributors…
Cannot retrieve contributors at this time
54 lines (44 sloc) 1.8 KB
# Copyright (c) 2016 Microsoft Corporation. All Rights Reserved.
# Licensed under the MIT License (MIT)
function Export-RsSubscriptionXml {
This script exports one or more subscriptions that have been retrieved via Get-RsSubscription.
This script exports subscriptions to an XML file using Export-CliXml with a -Depth of 3.
Use Import-RsSubscriptionXml to later re-import the subscriptions as valid subscription objects
for use with Set-RsSubscription to implement in SRSS.
The path to save the XML formatted file that will contain the exported subscription/s.
.PARAMETER Subscription
One or more subscription objects, typically retrieved via Get-RsSubscription.
Get-RsSubscription -path '/path/to/my/report' | Export-RsSubscriptionXml .\MySubscriptions.xml
This command will export the current set of subscriptions contained in '/path/to/my/report' to an
XML file named MySubscriptions.xml.
[cmdletbinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')]
[Parameter(Mandatory = $True, ValueFromPipeline=$true)]
Begin {
$Subscriptions = @()
Process {
$Subscriptions = $Subscriptions + $Subscription
End {
if ($PSCmdlet.ShouldProcess($Path, "Exporting subscriptions"))
Write-Verbose "Exporting subscriptions to $Path..."
$Subscriptions | Export-Clixml $Path -Depth 3