RS utility parameters
I'm trying to use the rs utility on the command line, but all the examples I've found use only 1 parameter. I want to use multiple parameters and have not been able to get it working. Can anyone advise if this is possible, and if so, how to do it. Thanks in advance Jez
May 23rd, 2006 1:39pm

Hi, following the script (rss) file definition that accepts the datasource from the rs command line stmt. myfile.rss Dim definition As [Byte]() = NothingDim warnings As Warning() = NothingDim parentFolder As String = "MyReports"Dim parentPath As String = "/" + parentFolderDim filePath As String = "C:\Reports\" Public Sub Main() rs.Credentials = System.Net.CredentialCache.DefaultCredentials Dim name As String 'Create the parent folder Try rs.CreateFolder(parentFolder, "/", Nothing) Console.WriteLine("Parent folder created: {0}", parentFolder) Catch e As Exception Console.WriteLine(e.Message) End Try 'Create the WOS shared data source CreateDataSource() 'Publish the reports PublishReport("Report1") PublishReport("Report2") End Sub Public Sub CreateDataSource() Dim name As String = "AFES_DB" Dim parent As String = "/" + parentFolder 'Define the data source definition. Dim definition As New DataSourceDefinition() definition.CredentialRetrieval = CredentialRetrievalEnum.Store definition.ConnectString = "data source=" & datasource & ";initial catalog=NorthWind" definition.Enabled = True definition.EnabledSpecified = True definition.Extension = "SQL" definition.ImpersonateUser = False definition.ImpersonateUserSpecified = True 'Use the default prompt string. definition.Prompt = Nothing definition.WindowsCredentials = False definition.UserName = "sa" definition.Password = "" Try rs.CreateDataSource(name, parent, True, definition, Nothing) Catch e As Exception Console.WriteLine(e.Message)End Try End Sub Public Sub PublishReport(ByVal reportName As String) Try Dim stream As FileStream = File.OpenRead(filePath + "\" + reportName + ".rdl") definition = New [Byte](stream.Length) {} stream.Read(definition, 0, CInt(stream.Length)) stream.Close() Catch e As IOException Console.WriteLine(e.Message) End Try Try warnings = rs.CreateReport(reportName, parentPath, True, definition, Nothing) If Not (warnings Is Nothing) Then Dim warning As Warning For Each warning In warnings Console.WriteLine(warning.Message) Next warning Else Console.WriteLine("Report: {0} published successfully with no warnings", reportName) End If Catch e As Exception Console.WriteLine(e.Message) End TryEnd Sub the rs command should be as follows rs -i myfile.rss -s http://localhost/reportserver -v datasource=cpc2 u can also send the ParentFolder name from the command line. all u need to do is remove the statement Dim parentFolder As String = "MyReports" in the above rss file and add the value in the command line as follows rs -i myfile.rss -s http://localhost/reportserver -v datasource=cpc2 -v parentFolder=myReports if u wanna add few more parameters just use the -v switch followed by name and value.
Free Windows Admin Tool Kit Click here and download it now
May 23rd, 2006 2:04pm

Thanks - I got it working
May 23rd, 2006 3:52pm

Hi Chakra, Your post is very useful for me too. But I have another issue. How to pass date-type parameter? I am having trouble passing date type parameter into my report and always getting "Default value or value provided for the report parameter 'myParam' is not a valid value". Thanks in advance, Man
Free Windows Admin Tool Kit Click here and download it now
September 18th, 2006 8:05am

hi could youp lese help me because is am running that on command line but it doesnot work for me it gives me error saying that unused local variable 'Name' and datasource is a type and cannot use as expression!! What should i do! Thanks
October 19th, 2007 10:56pm

Hi,Can I have a look at your script?It will be easier for me to help you by looking at your script.Thanks
Free Windows Admin Tool Kit Click here and download it now
October 19th, 2007 11:56pm

Hello - I realize this is an old posting but I'm starting to use the rs utility and I wondered something. I am going to need this to work for other users on our network. Does each machine need to have Reporting services for developers installed in order for it to work? It works for me and another developer here because we both have that installed - others do not. Is there a way to just install the rs utility? Is there a way we could run remotely and not have to do this install? any info would be great! Thanks - NikkiZ
September 8th, 2008 8:13pm

Hi NIkkiZ,Yes, you can run rs utility remotely.See this: http://msdn.microsoft.com/en-us/library/ms162839.aspxHope this help.Cheers,Uzzi
Free Windows Admin Tool Kit Click here and download it now
September 10th, 2008 5:41am

yes, I've read this article - That is the way I've been running the script but if the local user does not have RS installed on their own local machine rs cannot be found and will not run. I found another way around and I'm able to do what I wanted just without using the rs utility. Thanks Uzzi NikkiZ
September 10th, 2008 9:47pm

Hi NikkiZ, If you don't mind, could you please share you method? Cheers, Uzzi
Free Windows Admin Tool Kit Click here and download it now
September 11th, 2008 1:04am

Hi NikkiZ,Also one more thing, could you please mark Answered to your question?Cheers,Uzzi
September 11th, 2008 3:11am

sorry this has taken me so long to write back. What i did to get around the issue of having RS installed on everyone's local machine was simply to call the report through my ERP tools programming language. Basically just ran a command line utility that had http://report.server.com/reportsservername/the rest of the path and name of the report. At the end you just have your param1=vari1&param2=var2&rs:Format=PDF. This opened a webbrowser, ran the RS report and a box pops up allowing the user to either view the PDF report or save it. Works perfectly. Let me know if there is anything else you might be interested in. thanks!
Free Windows Admin Tool Kit Click here and download it now
October 10th, 2008 7:46pm

hi sorry - not sure how to mark Answered to my question. All is see are buttons yes/no whether a post was helpful?
October 10th, 2008 7:48pm

You can do a multiple parameter by adding -v but how about multi-valued parameter. For eg, -V projectname="Omega,Beta" If I pass just Omega or Beta seperately, it works but can we do a multi-valued?? Please helpPolly Cassidy
Free Windows Admin Tool Kit Click here and download it now
March 5th, 2011 8:46am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics