In addition to MMC Snap-In, the Device Monitoring Studio Server may be managed using the API it provides. The first thing a user must do is to create a management object:
var dms = new ActiveXObject("dmssrv.MonitoringSite");
$dms = New-Object -ComObject 'dmssrv.MonitoringSite'
The caller must be a member of local or domain Administrators group and must be elevated in order to connect to management object.
Management object provides two events: _IMonitoringAdminEvents.OnConnectionAdded and _IMonitoringAdminEvents.OnConnectionRemoved. Connection object provides two events as well: _IConnectionEvents.OnSessionAdded and _IConnectionEvents.OnSessionRemoved.