Need script to check disconnected user RDP session on windows 2008 R2 server and send email to those respective users RRS feed

  • Question

  • Hi,

    I am looking for a script (VB or Powershell) to find out how many Disconnected RDP session on Windows 2008 R2 server and send email notification top users.

    I have following script for searching disconnected session but  not sure how I can send email to those users...can someone pls guide me.

    In our ad enviroment, user naming format is like for e.g. "abc12345" but their email id starts like

    #import psTerminal Services
    import-module psTerminalServices
    #Grab Date and convert to -1 hours.
    $date = (Get-date).AddHours(-1)
    $finalDate = Get-date $date -format G
    #Get Disconnected Terminal Services Sessions
    $Sessions = get-tssession | where {(($_.state -eq "Disconnected") -and ($_.useraccount -like "DOMAIN\*") -and ($_.disconnecttime -lt $finaldate))}

    Thanks & Best Regards, MPG

    Wednesday, July 2, 2014 7:38 AM


All replies