Today’s script took a long time to write. The concepts are fairly simple and the resulting script is quite trivial but the lack of easy to find documentation on Reporting Services administration via scripts meant I got to spend a lot of time with my good friend intellisense. In fact, it actually led me to go out and download PowerGUI and start using it again just to get intellisense.
Now that I am done whining about how difficult it was, let’s talk about the script. Ever had to change the login information for all reports in a particular folder? In my case I was going from SQL authentication to Windows authentication for 4 folders with 15-20 reports each. I had done this before, manually, but I broke a few reports and it took hours to complete. Having to do the whole thing a second time meant a script was in order.
The script below is pretty simple and could easily be turned into a function. It takes a target server, target folder, user name to change to and password to assign. I have the script hard-coded to use Windows Credentials because that is all I have tested with. With that information the script walks through the folder and adjusts the first data source on each report. If you have multiple data sources then you will want to add code to handle that. That is it. (I told you the result is deceptively simple.)
Here is the code:
So that’s it. I hope you find this script helpful. Please let me know if you run into any issues with it or know a better way to do the same thing. Please keep in mind that scripts from the internet are like Halloween candy, inspect before consumption. I offer no warranty beyond a sympathetic ear if you should run into any issues.