First published on TECHNET on Feb 01, 2010
One of the questions I often get is “How can I tell which users are currently connected to the Service Manager Data Access Service?” or “How can I tell how many people are connected to Service Manager?”
We have a method on the Service Manager SDK which will tell you which users have a connection to the Service Manager Data Access Service called GetConnectedUsers(). This method will return a IList of user names.
To provide a handy tool for people and demonstrate how this works I’ve created a simple console application that basically connects to Service Manager, calls this method, and outputs the list of user names to the standard out:
EnterpriseManagementGroup emo = new EnterpriseManagementGroup(strManagementServer);
foreach (String strIUserName in emo.GetConnectedUserNames())
{
Console.WriteLine(strIUserName.ToString());
}
I added support for passing the server name you want to connect to as a parameter like this:
GetConnectedUsers.exe –Server myservername
If you don’t pass a –Server parameter it will assume that you want to connect to ‘localhost’.
I’ve put the tool and source code up on the SkyDrive:
http://cid-17faa48294add53f.skydrive.live.com/self.aspx/.Public/GetConnectedUsers.zip