How do I stop Remote Desktop from locking

To some people, the apparent lack of the computer locking function during Remote Desktop Connection is a major flaw. This would be the case, if it were true. Though the standard Windows key + L does not work during a Remote Desktop Connection, you have the ability to save a shortcut to your desktop that will allow you to lock the computer.

Create Shortcut to Lock Remote Computer

1. Right-click on your desktop, select “New,” then “Shortcut.”

2. Type rundll32 user32.dll,LockWorkStation into the “Type the location of the item” text field, then click “Next.”

3. Type a name for your shortcut into the “Name” text field (e.g., “Lock My PC”) and then click “Finish.”

4. Double-click on your new shortcut to lock your computer. This will work even from a Remote Desktop Connection.

Execute Remote Computer Lock via Interner

Not everyone knows, but on computers, laptops and tablets with Windows 10 there is a device search function via the Internet and a remote computer lock, similar to that found on smartphones. Thus, if you have lost a laptop, there is a chance to find it, moreover, remote locking of a computer with Windows 10 can be useful if for some reason you forgot to leave your account, and it would be better to do it.

First, about the requirements that must be met in order to take advantage of the possibility described:

  • The computer being locked must be connected to the Internet.
  • It should enable the “Find My Device” feature. Usually this is the default, but some programs for disabling the spyware features of Windows 10 may disable this feature as well. You can enable it in Options – Update and Security – Find My Device.

  • Microsoft account with administrator rights on this device. It is through this account that the lock feature will be executed.

If all specified is satisfied, you can proceed. On any other device connected to the Internet, follow these steps:

1. Go to https://account.microsoft.com/devices and enter your Microsoft account login and password.

2. A list of Windows 10 devices using your account opens. Click “Show Details” on the device you want to block.

3. In the properties of the device, go to the item “Find my device.” If it is possible to determine its location, it will be displayed on the map. Click the “Lock” button.

4. You will see a message stating that all sessions will be terminated, and local users are disabled. Logging in as administrator with your account will still be possible. Click “Next”.

5. Enter the message to be displayed on the lock screen. If you lost your device, it makes sense to specify ways to contact you. If you simply block your home or work computer, I am sure that you will be able to come up with a decent message.

6. Click the “Lock” button.

After pressing the button, an attempt will be made to connect to the computer, after which all users will log out and Windows 10 will be blocked. On the lock screen, the message you specified is displayed. At the same time, the email address associated with the account will receive a letter about the blocking.

At any time, the system can be unlocked again by logging in with a Microsoft account with administrator privileges on this computer or laptop.

Consider Using Action1 to Lock Remote Computer if:

  • You need to perform an action on multiple computers simultaneously.
  • You have remote employees with computers not connected to your corporate network.

Action1 is a cloud-based platform for patch management, software deployment, remote desktop, software inventory asset management tools, and endpoint management.

Corporate Windows computers and servers are usually configured to lock the screen after some time of inactivity.

This is especially inconvenient when your remote desktop session keeps disconnecting with “RDP Session Timeout” each time after few minutes of being idle.

In this article i will show how to stop computer from locking and keep the remote desktop session alive without any 3rd party tools and admin privileges, but with just 2 lines in PowerShell.

Cool Tip: Keyboard key press simulation using Arduino! Read more →

Prevent Lock Screen Timeout in Windows

To prevent Windows from locking when idle, to prevent termination of RDP session after timeout and to keep Skype for Business or any other messenger from going inactive, you can simulate key pressing with PowerShell.

Simply open the PowerShell and execute the following two lines of code:

$WShell = New-Object -Com "Wscript.Shell" while (1) {$WShell.SendKeys("{SCROLLLOCK}"); sleep 60}

The first line creates a Windows scripting -Com Wscript.Shell object, while the second line creates an infinite loop during which it presses the SCROLLLOCK key (which seems to be useless nowadays) each minute.

These lines can be saved as a file with .ps1 extension, e.g. Disable-Screen-Lock.ps1, that can be executed with the right click and “Run with PowerShell“.

This PowerShell script will prevent the “RPD Session Timeout“, will stop your computer from locking, will disable screensaver and will make your Skype status always online.

Cool Tip: Clear history of previous commands in PowerShell! Read more →

In the end of your RDP session, open the Command prompt as Admin and:

tscon 1 /dest:console

When connected to the local console (using the /admin)

Because the tscon.exe needs to be run elevated (as administrator), you can also create an elevated shortcut by the command and place the shortcut on desktop of the host. Now when you want to disconnect the session and unlock the remote host restoring the local user's desktop, simply double click / tap the shortcut.

Regards

Please remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact .

Imagine this... reopening the conversation after all this time! LOL!The "TSCON.exe 0 \dest:console" solution has served me well for a long time, but now I have to use virtual machines in Atlanta that have to have Server 2003 on them (instead of XP Pro). When I tried this approach to disconnect I found that an error is returned...***Could not connect sessionID 0 to sessionname console, Error code 7045Error [7045]:The requested session access is denied.***I've spent the past three weeks (on and off) trying to find any kind of solution to this. I've discovered some related DOS/Windows commands QWINSTA, RWINSTA, TSDISCON), but none of these have given me any insight into what's wrong.

Help me... anyone... please!!!

Nepatsfan wrote:

I'm a sir, but can't claim to be a "GENIOUS"!

21-Sep-07

I am a sir, but cannot claim to be a "GENIOUS"! I first learned

of that command on this very newsgroup. Glad to hear it worked

for you.

Nepatsfan

Previous Posts In This Thread:

On Friday, September 21, 2007 4:10 PM
SonicForc wrote:

Can I stop Remote Desktop from locking host?

Thanks,
Graham

On Friday, September 21, 2007 5:56 PM
Nepatsfan wrote:

Re: Can I stop Remote Desktop from locking host?

I don't know how you can work this into your situation, but I'll pass it along. The following command can be run on the remote computer and it will leave the system unlocked with the

account that was used during the remote session logged on.

tscon.exe 0 /dest:console

I connect remotely to my XP Pro system using the credentials of the main account on that machine. I created a batch file that runs that command and placed it in the C:\Windows folder of the remote computer. The batch file is named Disconnect.bat. I then put a shortcut to the batch file in the All Users\Desktop folder. I also changed the shortcut's icon to match the one for

"Turn Off Computer" on the Start menu.

Instead of closing the remote desktop connection on my local computer, I double click the shortcut on the remote computer to

end the session.

Good luck

Nepatsfan

On Friday, September 21, 2007 6:40 PM
SonicForc wrote:

Sir (or Madam?


Sir (or Madam?!)... you are a GENIOUS!

Thanks, that works perfectly.

All the best,
Graham

--------

"Nepatsfan" wrote:

On Friday, September 21, 2007 6:49 PM
Nepatsfan wrote:

I'm a sir, but can't claim to be a "GENIOUS"!

I am a sir, but cannot claim to be a "GENIOUS"! I first learned

of that command on this very newsgroup. Glad to hear it worked

for you.

Nepatsfan

Submitted via EggHeadCafe - Software Developer Portal of Choice Free Commercial Icons and Graphics

http://www.eggheadcafe.com/tutorials/aspnet/97aabdf5-9a17-468b-9c33-8342a3afad82/free-commercial-icons-and.aspx