A WMI query for report service instances returns all instances regardless of the parent SQL server path

We have code to identify instances of SQL Server and their associated report server instances that return unexpected results.

The machine has two instances SQL Express (2008) - (local)/SQLEXPRESSand (local)/EXPRESS_BOB- each with its own report server.

Using WMI, we identify instances of SQL Server, and this works as expected. For each instance, we then request RS instances as follows:

public void QueryServers(string wmiPath)
{
    using (
        var searcher = new ManagementObjectSearcher(
           wmiPath, 
           "Select * from MSReportServer_ConfigurationSetting"))
    {
        ManagementObjectCollection moc = searcher.Get();
        //
        // Process objects in moc
        //
    }
}

This is done for two wmiPath values ​​(note - Run as Admin required):

  • wmiPath = "root \ Microsoft \ SqlServer \ ReportServer \ RS_SQLEXPRESS \ v10 \ Admin"
  • wmiPath = "root \ Microsoft \ SqlServer \ ReportServer \ RS_EXPRESS_5fBOB \ v10 \ Admin"

wmiPath, moc :

  • moc [0] [ "InstanceName" ] = "SQLEXPRESS"
  • moc [1] [ "InstanceName" ] = "EXPRESS_BOB"

, SQL Server WMI , ( ), ?

?

+5
1

(. http://msdn.microsoft.com/en-us/library/ms152836.aspx)

"Where InstanceName='<instance name>'"

+3

All Articles