WMIPing Utility

I am working on a project that needs to connect to the SQL Server Reporting Services WMI Provider on remote machines.  I have had to work with a number of issues around security and needed a simple tool to help me diagnose them.  To that end I wrote a simple command line application in C# that allows me to pass in a target WMI Namespace as well as optional user name, password, and domain name values to test connectivity.  I thought some others might find it useful as well so I am posting it here.

You can download my WMIPing utility and the .NET (Visual Studio 2008) source code here.

If you are learning to use WMI from .NET, this may also server as a simple sample project.

Let me know if you use it, like it, hate it, want to change it, etc. However, I reserve no rights so feel free to change it on your own as you wish.

There is a readme included with the utility, but the usage is:

WMIPing <TargetNamespace> [<UserName>] [<DomainName>]

Where:
  <TargetNamespace> = The target WMI namespace to connect to.
                      For example:

                      "root\cimv2"

                      To ping a namespace on a
                      remote machine start the namespace with the target
                      machine name.  For example:

                      "\\<remotemachinename>\root\cimv2"

                      For a remote machine named "MyServer":

                      "\\MyServer\root\cimv2"

  [<UserName>]      = The optional user name to use when connecting remotely
                      You will be prompted for the password to use
  [<DomainName>]    = The domain to use when connecting remotely.
                      Requires <UserName>

FYI, If you are in the same boat as me and need to connect to a SQL Server Reporting Services instance, you can use this utility to test connectivity to the namespace.

WMIPing "\\<ServerName>\root\Microsoft\SqlServer\ReportServer\RS_<InstanceName>\v10" (assuming it is SQL 2008 or SQL 2008 R2)

In my dev environment, my reporting services server name is called “SQLVM” and I have a default instance (MSSQLSERVER) and named instance named “SQL2008”. 

Testing connectivity to the default instance (MSSQLSERVER) on the SQLVM server would look like:

WMIPing "\\SQLVM\root\Microsoft\SqlServer\ReportServer\RS_MSSQLSERVER\v10"

Connecting to the “SQL2008” named instance would look like:

WMIPing "\\SQLVM\root\Microsoft\SqlServer\ReportServer\RS_SQL2008\v10"

etc.

The WMIPing utility doesn’t do anything other than test that you can successfully connect from your client machine to the desired WMI namespace on the target server.