Friday, March 9, 2012

[OpsMgr 2007] Powershell Script to list Number of active SDK connections per user

I've already post a short word on this :  >>>>>>>>>> HERE <<<<<<<<<<

And here is a smal improvment that count the number of connection by connected users :)

Replace My.Server.FullName by your RMS fullname.
  1. # Connect your environment
  2. add-pssnapin "Microsoft.EnterpriseManagement.OperationsManager.Client";
  3. set-location "OperationsManagerMonitoring::";
  4. new-managementGroupConnection -ConnectionString:My.Server.FullName;
  5. set-location My.Server.FullName;
  6. # Get the connected users
  7. $SDKUsers = Get-ManagementGroupConnection | foreach-object {$_.ManagementGroup.getConnectedUserNames()} | sort
  8. $SDKNumberConnections = $SDKUsers | measure-object
  9. # number of active connections
  10. $SDKNumberConnections.count
  11. # count active connections per users
  12. $hash =@{}
  13. $SDKUsers | % {$hash[$_] = $hash[$_] + 1 }
  14. $Result = $hash.getenumerator() | ? { $_.value -gt 0 }
  15. $Result | sort value -DESC

 The result will be a table with the user account and the number of actives connections :


This can be a very usefull information to be able to investigate who is connecting the SCOM environment and why why have too much active connection.
Having too much SDK connection make the environment very slow.

This posting is provided "AS IS" with no warranties.

No comments:

Post a Comment