close all RDP sessions for all servers only, found in AD

This topic contains 0 replies, has 1 voice, and was last updated by Profile photo of Forums Archives Forums Archives 5 years, 5 months ago.

  • Author
    Posts
  • #6225

    by rthilo at 2012-12-06 10:39:11

    Hi.

    Up to now I used CMD or Autoit Scripting to reset RDP Sessions for Servers, using the buildin local scheduler. (qwinsta.exe + rwinsta.exe)

    I'm just wondering, if there might be an approach to consolidate this, so that it can be done from one PC/Server, that's quering AD for all servers, then get a list for all RDP sessions of these servers, then reset (forced) all of them.

    RDP sessions to workstations shall remain untouched.

    To get all servers in AD is not an issue. But how to get the RDP sessions, and how to reset them using PowerShell?

    get-QADComputer | ?{$_.OSName -match "server"}|ft name, osname -auto

    Any suggestions appreciated.

    by coderaven at 2012-12-06 10:56:40

    I have been using the PSTerminalServices Module hosted here.

    I think that is what you are looking for.

    by rthilo at 2012-12-06 11:50:25

    Hi.

    Thanks for your reply. Yes, this ....

    [list]PS > Get-Command -Module PSTerminalServices

    CommandType Name Definition
    ———– —- ———-
    Function Disconnect-TSSession ...
    Function Get-TSCurrentSession ...
    Function Get-TSProcess ...
    Function Get-TSServers ...
    Function Get-TSSession ...
    Function Send-TSMessage ...
    Function Stop-TSProcess ...
    Function Stop-TSSession ...

    [/list]

    ... looks like it's exactly what I was looking for.

    😀

You must be logged in to reply to this topic.