Powershell Log Off Remote Session

前端 未结 11 1213
情话喂你
情话喂你 2020-12-02 13:15

I am trying to formulate a Powershell command to remotely log off a user. We have a terminal server with a very unstable program that sometimes locks sessions. We have to re

11条回答
  •  温柔的废话
    2020-12-02 14:14

    Adding plain DOS commands, if someone is so inclined. Yes, this still works for Win 8 and Server 2008 + Server 2012.

    Query session /server:Server100
    

    Will return:

    SESSIONNAME       USERNAME                 ID  STATE   TYPE        DEVICE
    rdp-tcp#0         Bob                       3  Active  rdpwd
    rdp-tcp#5         Jim                       9  Active  rdpwd
    rdp-tcp                                 65536  Listen
    

    And to log off a session, use:

    Reset session 3 /server:Server100
    

提交回复
热议问题