Last active
December 13, 2016 18:00
-
-
Save automationhaus/766fa2c1941f0093243440971424cbce to your computer and use it in GitHub Desktop.
Function to get the client information for the RDS session running the command - Client Name, IP Address, Session Host, Session ID...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-RDSCurrentSession | |
{ | |
<# | |
.SYNOPSIS | |
Provides information about the current logged in session on the session host | |
.DESCRIPTION | |
Using Cassia .NET Library gathers information on the current logged in user/client on the local session host | |
.EXAMPLE | |
PS>Get-RDSCurrentSession | |
.OUTPUTS | |
Cassia.Impl.TerminalServicesSession | |
.NOTES | |
Britt Thompson | |
[email protected] | |
.LINK | |
http://code.google.com/p/cassia | |
.LINK | |
https://gist.github.com/amesritter/766fa2c1941f0093243440971424cbce | |
#> | |
[OutputType("Cassia.Impl.TerminalServicesSession")] | |
[CmdletBinding()] | |
param() | |
try | |
{ | |
Add-Type -Path "$PSScriptRoot\Bin\Cassia.dll" | |
$RDSClient = New-Object Cassia.TerminalServicesManager | |
$RDSClient.CurrentSession | |
} catch { Get-Catch } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Download the Cassia .NET library here and copy it to the Bin folder in your script path.