Reputation: 2356
Has anyone ever come across a way of a way to create an app that kind of mimics what Terminal Services manager does in Windows2003/XP.
I would like to write something that would either go and query a farm of server every n secs a get me a list of users logged in, there process's etc or do maybe type a username in and it goes and finds the user in the farm and returns their details.
Cheers Luke
Upvotes: 0
Views: 2002
Reputation: 1451
I would suggest using Cassia, a .NET library which uses internally the Wtsapi32 library Arnshea mentioned. For example, to list all users logged into a server:
Dim manager As New TerminalServicesManager()
Using server As ITerminalServer = manager.GetRemoteServer("your-server-name")
server.Open()
For Each session As ITerminalServicesSession In server.GetSessions()
If Not string.IsNullOrEmpty(session.UserName) Then Console.WriteLine(session.UserName)
Next
End Using
Upvotes: 2
Reputation: 12276
Take a look at psexec and the other ps* utilities from Microsoft (originally from SysInternals).
Upvotes: 0
Reputation: 11243
I've hacked this using qwinsta (query winstation is the mnemonic) and string parsing/regular expressions. Beware of firewalls and impersonation.
Upvotes: 1