Reporting Services(SSRS) Reports deployment using batch file(command line)

Create a batch file SSRS_Deployment.bat which will contain following code :

@Echo Off

for /f "tokens=2 delims=," %%a in ('type Config.csv ^| find "SSRS Reports Folder"') do set sourcePath=%%a

for /f "tokens=2 delims=," %%a in ('type Config.csv ^| find "SSRS Target Server"') do set SSRSTargetServer=%%a

for /f "tokens=2 delims=," %%a in ('type Config.csv ^| find "SSRS Target Folder"') do set SSRSTargetFolder=%%a

echo.*****************************************************************************
echo "SSRS Reports Deployment Started"
echo.*****************************************************************************
echo.

for %%f in ("%sourcePath%\*.rds") do XMLEditor %%f %DatabaseTargetServer% "rds"

for %%f in ("%sourcePath%"\*.rds) do rs -i MyRSS_rds.rss -s %SSRSTargetServer% -v sourcePath="%sourcePath%" -v targetFolder="%SSRSTargetFolder%" -v dataSource="%%~nf" -e Mgmt2010

for %%f in ("%sourcePath%"\*.rdl) do rs -i MyRSS_rdl.rss -s %SSRSTargetServer% -v sourcePath="%sourcePath%" -v targetFolder="%SSRSTargetFolder%" -v reportName="%%~nf" -e Mgmt2010

 

echo.*****************************************************************************
echo "SSRS Reports Deployment completed"
echo.*****************************************************************************
echo.

pause

 

 

All the required files are attatched in this post.

Zip file which contains following files :

  • Config.csv - This has all the configuration settings like folder name,server name etc.
  • MyRSS_rdl.RSS
  • MyRSS_rds.RSS
  • MyRSS_Folder

This deployment is for SSRS 2008 R2 in both native and sharepoint mode.Only SSRS 2008 R2 supports integrated mode command line deployment.For other lower versions of sql server remove -e Mgmt2010 from command.

 

MyRSS_rdl.zip