Categories: Windows

Windows – zdalne zakończenie zawieszonej sesji RDP

Nie możesz zdalnie zalogować się do sesji poprzez RDP na serwerze z Windows 2003/Windows 2003 R2 ponieważ otrzymujesz komunikat, że wszystkie sesje są zajęte, lub po prostu chcesz z nimi zrobić porządek.

Solution

(Opcjonalne) Ten krok jest opcjonalny, jeśli już jesteś zalogowany przy użyciu poświadczeń do innego serwera, który posiada wymagane uprawnienia.

Krok 1. Nadaj odpowiednie uprawnienia do zakończenia połączenia RDP komendą.

net use servername_or_IP /USER:username “password“

(Obowiązkowe) Poniższe kroki są obowiązkowe.

Krok 2. Wyświetl połączenie do danego serwera i uzyskaj ID sesji.

query session /server:servername

Krok 3. Zresetuj sesje, które nie są używane korzystając z ID sesji z kroku 2.

reset session ID /server:servername_or_IP

Przykład:

C:\Documents and Settings\server-userid3>query session /server:TEST2003
SESSIONNAME       USERNAME                 ID  STATE   TYPE        DEVICE
console                                     0  Conn    wdcon
rdp-tcp                                 65536  Listen  rdpwd
rdp-tcp#32        server-userid1            1  Active  rdpwd
rdp-tcp#33        server-userid2            2  Active  rdpwd
 C:\Documents and Settings\server-userid3>reset session 1 /server:TEST2003

This post was last modified on 20 marca, 2016 12:24

Przemyslaw Klys

System Architect with over 14 years of experience in the IT field. Skilled, among others, in Active Directory, Microsoft Exchange and Office 365. Profoundly interested in PowerShell. Software geek.

Share
Published by
Przemyslaw Klys

Recent Posts

Active Directory Replication Summary to your Email or Microsoft Teams

Active Directory replication is a critical process that ensures the consistent and up-to-date state of…

2 tygodnie ago

Syncing Global Address List (GAL) to personal contacts and between Office 365 tenants with PowerShell

Hey there! Today, I wanted to introduce you to one of the small but excellent…

5 miesięcy ago

Active Directory Health Check using Microsoft Entra Connect Health Service

Active Directory (AD) is crucial in managing identities and resources within an organization. Ensuring its…

7 miesięcy ago

Seamless HTML Report Creation: Harness the Power of Markdown with PSWriteHTML PowerShell Module

In today's digital age, the ability to create compelling and informative HTML reports and documents…

8 miesięcy ago

How to Efficiently Remove Comments from Your PowerShell Script

As part of my daily development, I create lots of code that I subsequently comment…

8 miesięcy ago

Unlocking PowerShell Magic: Different Approach to Creating ‘Empty’ PSCustomObjects

Today I saw an article from Christian Ritter, "PowerShell: Creating an "empty" PSCustomObject" on X…

9 miesięcy ago