04 November 2015

Publish reports on several SSRS servers

When updating more than one AOS with new code you probably want to publish new SSRS Reports to more than one SSRS Server. The following powershell script will help a lot.
Thanks to Allan Andersen


$SSRSServers = "SSRS-Test", "SSRS-Training", "SSRS-Demo", "SSRS-Prod"

ForEach ($SSRSServer in $SSRSServers)
{
    #create PowerShell Session

    $PSSession = New-PSSession -EnableNetworkAccess -Name $SSRSServer

    Invoke-Command -Session $PSSession -ArgumentList $SSRSServer -ScriptBlock
    {
        #load AX ManagementUtilities 

        .'c:\Program Files\Microsoft Dynamics AX\60\ManagementUtilities\Microsoft.Dynamics.ManagementUtilities.ps1' 

        #publish report
        Publish-AXReport -Id $args[0] -ReportName * -ModifiedAfter (Get-Date).AddDays(-30) -Verbose
    }

    Remove-PSSession $PSSession



Depending how you do deploy Reports in your Environment you can also use WSDL Port ( -ServicesAOSWSDLPor) or other parameters of the Publish-AXReports command.
Post a Comment