c# - WMI query of reporting service instances returns all instances regardless of parent sql server path -


We have some code to identify SQL Server instances and their related reporting server instances that return unexpected results is.

One machine two examples SQL Express (2008) - (local) / Sclekspasn and (local) / EXPRESS_BOB - each with its own reporting server while with

using WMI, we each example, identify instances of SQL server and required work we inquiry follows the RS examples:

  Public Zero Q & A (string wmiPath) {(var search Ta = new management object finder (wmiPath, "select * from MSReportServer_ConfigurationSetting") {managementObjectCollection Moc = Explorers. Go (); / /> Process moc // objects}}   

It is run for the two values ​​of wmiPath (Note - you need to run as administrator): < blockquote>

  • wmiPath = "root \ Microsoft \ SqlServer \ ReportServer \ RS_SQLEXPRESS \ v10 \ admin"
  • wmiPath = "root \ Microsoft \ SqlServer \ ReportServer \ RS_EXPRESS_5fBOB \ v10 \ admin" < / li>

    wmiPath , moc Collection always has two value < / p>

    • moc [0] [ "instances -nam"] = "SQLEXPRESS"
    • moc [1] ["InstanceName"] = "EXPRESS_BOB"

      How could it be Under the examples of a specified SQL Server, the WMI path report server gives examples (which I hope) to be under a different path << P>

      It appears by design

      to add " where instanceName = '& lt; instance name & gt;' query may p

Comments