$server = "TestServer123" #define the server to connect to
$session = New-PSSession -ComputerName $server #Create a new remote PS Session.
$events = Invoke-Command -Session $session -ScriptBlock {Get-WinEvent -FilterHashTable @{LogName="Microsoft-Windows-TerminalServices-LocalSessionManager/Operational"; ID=40}}
Remove-PSSession $session
http://gallery.technet.microsoft.com/scriptcenter/e8c3af96-db10-45b0-88e3-328f087a8700