Tuesday, March 27, 2012

Check remotely if Reporting Services exist

is there a way to check the reporting services remotely.. using the reporting services url?

What do you actually Mean by checking reporting Services remotely? What is your requirement?|||

i want to check if a remote server has an existing reporting service or runs a reporting service...

|||You can check using


http://servername/reportserver


or


http://servername/reports

|||

yeah... but how can i check it programatically?|||Can you specify the scenario where you need this checking.May be I can help you|||

im trying to make an application that can connect to multiple report server... i need to get all the available report server within the network then connect to that report service...

|||

hii

Is this the thing you mean to say i mean you want to see your reporting serverices ?

if this the thing u wanted then you can go for the following path.

C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServe

cheers

regards

Mahasweta

|||May be this will help you


Check the link


http://msdn2.microsoft.com/en-us/library/aa226200(SQL.80).aspx



using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using System.Management;

using System.IO;

[assembly: CLSCompliant(true)]


namespace TGest

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}


private void Form1_Load(object sender, EventArgs e)

{

const string WmiNamespace = @."\\localhost\root\Microsoft\SqlServer\ReportServer\v9\Admin";

const string WmiRSClass =

@."\\localhost\root\Microsoft\SqlServer\ReportServer\v9\admin:MSReportServer_ConfigurationSetting";

ManagementClass serverClass;

ManagementScope scope;

scope = new ManagementScope(WmiNamespace);


// Connect to the Reporting Services namespace.

scope.Connect();

// Create the server class.

serverClass = new ManagementClass(WmiRSClass);

// Connect to the management object.

serverClass.Get();

if (serverClass == null)

throw new Exception("No class found");


// Loop through the instances of the server class.

ManagementObjectCollection instances = serverClass.GetInstances();


foreach (ManagementObject instance in instances)

{

MessageBox.Show("Instance Detected");


}


}


}

}

|||

thanks man! i got all the reporting services instance in my local my machine... but im trying to access a remote workstation and get all the report server instance in there... but im getting an error "{"Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"}". i've already use a default authentication level(Windows authentication). here's my code..

Code Snippet

try

{

const string WmiNamespace = @."\\bserver\root\Microsoft\SqlServer\ReportServer\v9\Admin";

const string WmiRSClass =

@."\\bserver\root\Microsoft\SqlServer\ReportServer\v9\admin:MSReportServer_ConfigurationSetting";

ManagementClass serverClass;

ManagementScope scope;

ConnectionOptions options;

options = new ConnectionOptions();

options.Authentication = AuthenticationLevel.Default;

scope = new ManagementScope(WmiNamespace,options);

// Connect to the Reporting Services namespace.

scope.Connect();

// Create the server class.

serverClass = new ManagementClass(WmiRSClass);

// Connect to the management object.

serverClass.Get();

if (serverClass == null)

throw new Exception("No class found");

// Loop through the instances of the server class.

ManagementObjectCollection instances = serverClass.GetInstances();

foreach (ManagementObject instance in instances)

{

Console.Out.WriteLine("Instance Detected");

PropertyDataCollection instProps = instance.Properties;

foreach (PropertyData prop in instProps)

{

string name = prop.Name;

object val = prop.Value;

Console.Out.Write("Property Name: " + name);

if (val != null)

Console.Out.WriteLine(" Value: " + val.ToString());

else

Console.Out.WriteLine(" Value: <null>");

}

}

}

catch (Exception ex)

{

MessageBox.Show(ex.Message);

}

thanks!! Smile

No comments:

Post a Comment