Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

how to see when and who log off my rdp session?and how to block that?

Posted on 2016-09-07
5
Medium Priority
?
62 Views
Last Modified: 2016-09-10
First of all i wanna know how to block,hide anyone to end my rdp session ,also.........mmm  i wanna know if there is a solution to see who log off my rdp session?any command for powershell?can anyone help me?thank you
0
Comment
Question by:john lambert
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 71

Expert Comment

by:Qlemo
ID: 41787386
If you need to have RDP allowed, all you can do is to disallow login for anybody else, by removing the Interactive Login privilege.
0
 

Author Comment

by:john lambert
ID: 41787397
i have administrator rights,me other 3 persons, so i can't do that
0
 
LVL 71

Expert Comment

by:Qlemo
ID: 41787522
There is no way on a client Windows OS. A server OS is different, if different users are used. But a client OS only allows one active login (RDP) at any time, others are suspended (if Fast User Switching is allowed, otherwise logged off) after notice.
If the same login is used, the session is taken over without notice, even if the original RDP session is still active and connected.

For scenarios where multiple user are able to connect to a single machine with the same user in our company, I have set up a remote test for active RDP session, and stopping the connect attempt if there is one. This requires to run a batch file instead of mstsc.
0
 

Author Comment

by:john lambert
ID: 41787572
can u create a batch file pls?
0
 
LVL 71

Accepted Solution

by:
Qlemo earned 2000 total points
ID: 41788286
You are required to be able to map a network drive to the RDP target without having to provide login data.
Also psExec from www.sysinternals.com has to be available in the same location as the batch file.
I've hard-coded the RDP target if not provided on the command line when calling the batch file (variable PC).
@echo off
setlocal EnableDelayedExpansion
set pc=%1
if "%1" == "" set pc=MaintenancePC
for /F "tokens=3,4 delims=: " %%C in (
  '2^>nul %~dp0psexec \\%pc% cmd /c netstat ^| findstr /i /R /c:" *TCP *.*:3389 *.*:" /c:" *TCP *.*:ms-wbt-server *.*:" ^| findstr /v /l "localhost [::1] 127.0.0.1" '
) do (
  echo      *** Currently connected to %pc%: %%D
  set rdpconn=no
  pause
)
if not defined rdpconn start "" mstsc /v:%pc%

Open in new window

psExec allows to hard-code login if required, but then you'll have to provide the plain text password in the script.
2

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question