RDExSessionInfo – gain visibility of RDP sessions in PowerShell
Have you ever wondered why it is so difficult to obtain basic data about RDP sessions like screen resolution, idle time, client name and so on in scripting languages? Me too. So I broke out Visual Studio and wrote a PowerShell module to wrap bits and pieces of the native „wtsapi32.dll“ API into more palatable PowerShell. Learned a lot along the way, too.
Give RDExSessionInfo a spin – it’s free forever and might just give you that bit of information you wondered how to get for your IT automation.
This is a work in progress, the following features are plannend:
- collecting data from multiple hosts so that you can pipe input from Get-RDUserSession in an RDS Deployment
- Further in-depth data, e.g. about RemoteFX and particular Virtual Channels (need to see if I can unearth any comprehensive API documentation here)
- A 2nd Cmdlet to query server configurations, so as to make the module more complete
The module exports a single cmdlet:
Get-RDExSessionInfo [-UserName <User...>] [-HostServer <server name>]
Here’s an example of a quick overview:
You can reduce the number of sessions returned by the cmdlet by specifying one or more values for UserName. An array of user names can be passed both as parameter value and through the pipeline.
The output object „RDEXSessionInformation“ has the following properties (EncryptionLevel is not yet populated):
The module is published on the PSGallery (https://www.powershellgallery.com/packages/RDExSessionInfo). You can also download the current release here.
Version history and Changelog
|12.11.2016||220.127.116.11||A single remote server can be queried (-HostServer parameter)
Date/time values that do not have a value return NULL instead of 01.01.1601 01:00:00
Any feedback is greatly appreciated. Feel free to get in touch 🙂