posted on Tuesday, November 09, 2004 10:05 AM
by
thomasswilliams
Reporting Services rs.exe Utility
This week I've had the opportunity to write a batch file which is run from the rs.exe command-line tool to administer Reporting Services.
As far as I can tell, there's 3 ways you can create folders or deploy reports or change settings in Reporting Services: from within Visual Studio.NET; using the Report Manager web interface; and using rs.exe (which is itself a wrapper for Reporting Services web service calls). I use the first way to do simple things like deploy reports until our virtual folder structure got deeply nested, where I switched to the second way - design and build the report in Visual Studio.NET, then go to my web browser and upload the file.
I didn't get to use rs.exe until recently because I really had no need. This command-line utility takes a script file which is written in VB.NET (not VBScript) and performs actions on a Reporting Services server like uploading reports, creating folders, creating data sources, setting properties, etc. Within a short time I had adapted some sample scripts and written a VB.NET file with the special “rss“ extension in Notepad, and then set up the command line necessary to run it in a command prompt window.
After going through the edit, save, run command line cycle (which compiles the script into an exe in your temp folder, and then runs it) a few times I thought to myself that it would be far better to compose and run the file from the Visual Studio.NET UI to get full Intellisense, syntax coloring, etc. On opening the rss file with VS.NET I noticed that the file was not syntax colored and did not have Intellisense - which led me down the side track of trying to add that file extension so it could be handled like a “*.vb” file by VS.NET (I didn't figure out how to do this, though).
After finishing my task, I can say that rs.exe is definitely powerful but had some strange quirks that I hope get ironed out in future releases. The summary of my experiences is:
- VB.NET is very powerful, and all the namespaces are available in the “rss“ file (whoever came up with that extension? It is impossible to search the web with the term “rss“), but, I feel I should be able to edit the file with VS.NET to get syntax coloring and Intellisense (I know, I've laboured the point).
- There is no built-in method on the in-built “rs“ object for deleting an existing virtual folder in Reporting Services (without resorting to SOAP calls, I think). This was a bit of a problem as if a folder I was trying to add exists, I wanted to delete it and add it again, but eventually I settled on raising an error and quitting the script.
- If the script adds a folder, then adds a data source to the folder, then adds a report to the folder, I couldn't wrap it in a batch (using either “-b” as a command-line option or CreateBatch/CancelBatch within the script) as when I tried to do anything with the newly-created folder, I got an error “Folder doesn't exist”. I thought the batch would handle that...
- There's not a lot of sample scripts out there for using rs.exe, yet.
- I couldn't figure out how to get the name of the running script or the folder it's in, because rs.exe compiles the running script as a temporary exe in your temp folder. So, all Windows folders containing “rdl“ files for uploading had to be either hardcoded or passed in the command line.
- I couldn't work out how to exit the script with an error - like, a DOS error code - so, when an error came up that should cause the script to fail in it's entirety, I used the VB.NET keyword “End“ (which I thought was a bit nasty!)