Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to use the powershell 2 "Get-WmiObject" command to find the reporting service instance using this command

 get-wmiobject -class "MSReportServer_Instance" -namespace "root\Microsoft\SqlServer\ReportServer"


Get-WmiObject : Invalid class
At line:1 char:14
+ get-wmiobject <<<<  -class "MSReportServer_Instance" -namespace "root\Microsoft\SqlServer"
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], ManagementException
    + FullyQualifiedErrorId :     GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand


  • This is Powershell 2
  • OS = Windows Server 2008 R2 RC (x64)
  • SQL = SQL 2008 SP1 (x64)
  • Reporting Services is installed and works - have several reports running)
  • Everything is running on the same box (the script, SQL, SSRS)
  • Link to WMI info for SSRS:
  • I've tried (guessing) different variations on the namespace but nothing worked

THE ANSWER (2009-06-22)

The code below finds the instance and places it into *$rs_instance*

$ns = Get-WmiObject -class "__NAMESPACE" -namespace "root\Microsoft\SqlServer\ReportServer"
$rs_instance_name = "root\Microsoft\SqlServer\ReportServer\" + $ns.Name + "\v10"
$rs_instance = Get-WmiObject -class "MSReportServer_Instance" -namespace $rs_instance_name
share|improve this question
up vote 1 down vote accepted

Using WmiExplorer.ps1 script I can see the instance name in __NAMESPACE and this query returns my instance name:

gwmi -class "__NAMESPACE" -namespace "root\Microsoft\SqlServer\ReportServer"

To get to MSReporterServer_Instance you must supply the instance name in this example my instance name is RS_SQL2K8:

gwmi -class "MSReportServer_Instance" -namespace "root\Microsoft\SqlServer\ReportServer\RS_SQL2K8\v10"
share|improve this answer

First off, is it a valid class?

Try this: PS>get-wmiobject -list -namespace "root\Microsoft\SqlServer"

Does that class get listed?

Shortcut: PS>get-wmiobject -list -namespace "root\Microsoft\SqlServer"|where{$ -eq "MSReportServer_Instance"}

I have a VM running Server 2008 with SQL 2008 and can try this out tomorrow.

If you're not sure of the namespace: PS> Get-WmiObject -Namespace "root" -Class "__NAMESPACE" | Format-List Name

(That's from:

share|improve this answer
Actually, as per that link you provided, your namespace needs to look like this: root\Microsoft\SqlServer\ReportServer\<InstanceName>\v10 This works from a Microsoft VM: PS> get-wmiobject -class "MSReportServer_Instance" -namespace "root\Microsoft\SqlServer\ReportServer\rs_mssqlserver\v10" – Marco Shaw Jun 22 '09 at 15:48

If what you're trying to do requires WMI this may be missing the point, but SQL Server 2008 ships with managed extensions that means most automation tasks no longer need to be perfromed with WMI.

For example on a machine with the client extensions installed either select the DB with open in powershell right click context menu command or load the extensions in any powershell session ( and you can do the following:

PS > Set-Location \sql\MyServer\ReportServer

You can now manage the database objects just like you would manipulate your locla file system in PowerShell (for example try running dir . | Get-Member to see some properties to interact with).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.