Deploying SSRS Reports with PowerShell

Deploying SSRS Reports can be a painful task. 2012 is a bit better than 2008. It’s even worse if you do not have BIDS installed. And more worse if you use shared data sources. (telling from my recent experience)

Fortunately I found this PowerShell script, but unfortunately it lacks any sort of documentation.

After a bit of googling, and removing the lines

if ([Convert]::ToBoolean($ConnProps.IntegratedSecurity)) {
    $Definition.CredentialRetrieval = 'Integrated'
}

which always caused the error

ForEach-Object : Die IntegratedSecurity-Eigenschaft wurde für dieses Objekt nicht gefunden. Stellen Sie sicher, dass sie vorhanden ist. Bei D:\projects\wms\Deploy-SSRSProject.ps1\Deploy-SSRSProject.ps1:150 Zeichen:19 +     ForEach-Object <<<<  {
+ CategoryInfo          : InvalidOperation: (.:OperatorToken) [ForEach-Object], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFoundStrict,Microsoft.PowerShell.Commands.ForEachObjectCommand

ForEach-Object : Property ‘IntegratedSecurity’ cannot be found on this object; make sure it exists
At D:\projects\wms\Deploy-SSRSProject.ps1\Deploy-SSRSProject.ps1:150 char:19
+     ForEach-Object <<<<  {
+ CategoryInfo          : InvalidOperation: (.:OperatorToken) [ForEach-Object], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFoundStrict,Microsoft.PowerShell.Commands.ForEachObjectCommand

because my project uses SQL Authentication rather than integrated security to log on to the database.

I got the script to run using the following PS code:

$pwd = ConvertTo-SecureString "ThePassWord" -asplaintext -force
$cred = new-object System.Management.Automation.PSCredential "TheUser", $pwd
& ./Deploy-SSRSProject.ps1 -path "C:\path\to\my.rptproj" 
    -configuration "Debug" -credential $cred -verbose

where “Debug” is a configuration defined in the .rptproj.

After running the script, all .rdl files had the current timestamp on http://localhost/Reports/Pages/Folder.aspx?ItemPath=%2fMyProject&ViewMode=Detail.

The shared data source in the Data Sources directory are not being updated because the command line parameter -OverwriteDataSources is not passed to the New-SSRSDataSource function.

Advertisements

2 Responses to Deploying SSRS Reports with PowerShell

  1. devio says:

    Update: The PowerShell script has been moved here https://gist.github.com/jstangroome/3043878

  2. […] did not want to give in so easily, so I tried and verified that the procedure described in Deploying SSRS Reports with PowerShell still works for SSRS […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: