How to unlock Windows 7 screen using script

6,402

How to unlock Windows 7 screen using script

You can define and save an RDP file with all needed options, and point it to the machine to make the connection. You will set the configuration to save the credential and then enter and save the credential values. Now each time you double-click the RDP icon (from that same account and machine you created it on), it should automatically load the desktop for the user account credential you saved without needing to enter the password.

Configure RDP Icon

Press the Windows Flag Key one time and then immediately start to type in "MSTSC" or "Remote Desktop Connection" to find the Remote Desktop Connection app to launch, and then follow the below instructions for further steps.

enter image description here

Configure a Remote Desktop Connection and then Save to an RDP File

  1. Type in the Server Name or IP address in the Computer field (see below screen shot for #1 - #5)
  2. Type in the MachineName\Username in the Username field

    • Be sure to use the machine name backslash username in that format but you can replace the machine name with the IP address of the machine you are connecting to with the RDP file if you need to and know the IP address (assuming the IP address doesn't change)
  3. Be sure to select\check the Allow me to save credentials option

  4. Press the Save As option and tell it what to name the file and where to save it to so you can have the batch script launch it in later steps
  5. Press the Connect option and then follow the instructions below the screen shot below for what to do next to save the credential, and the rest

    enter image description here

  6. Type in the password of the account making the remote connection in the Password field (screen shot below)

  7. Check or select the Remember by credentials option and then press OK (screen shot below)
    • This step will need to be done only once per each logged in account that will need to open the connection and this will also be per machine that account logs into which it needs to perform this operation.
  8. Now simply double-click the RDP icon that you saved in the #4 step and confirm the RDP session opens without asking for password
  9. Now follow the instructions below for creating a batch script that will launch the RDP file to open the Remote Desktop Connection to the machine without needing to enter a password for the connection.

    enter image description here

For the last step you will create a batch script that will launch that RDP file you just defined and saved to open the connection without prompting for password. Be sure the full explicit path is what you point the script to for where you saved the RDP file in step #4 above where the script example has "C:\Users\User\Desktop\<ServerName or IP Address>.rdp".

Batch Script using MSTSC

@ECHO ON
MSTSC "C:\Users\User\Desktop\<ServerName or IP Address>.rdp"
GOTO EOF
Share:
6,402

Related videos on Youtube

Jakub
Author by

Jakub

Updated on September 18, 2022

Comments

  • Jakub
    Jakub over 1 year

    I am wondering if there is any way to unlock Windows 7 screen lock using a script. I have administrator permissions on this machine.

    I know this question have been asked before without a solution, but I hope someone has come up with answer since. I would like a script or program to be run, when certain conditions are met, which in result unlocks the screen.

    Alternatively is there any possibility to reliably disable communication with a computer with keyboard and mouse strokes while it displays a black screen? By that I mean: can I use low level programming to create screen lock which I can control. I hope it won't be necessary, as I got very promising answer.

    • Jakub
      Jakub almost 8 years
      Would unlocking using RDP unlock screen for local user as well? If so, yes. To the second question: yes as well, there is only one user on this machine.
    • Jakub
      Jakub almost 8 years
      My main goal is to have a machine unlock itself. If I understood you correctly then yes, entering a password on machine doing the unlocking is fine.
    • Jakub
      Jakub almost 8 years
      I wanted to run it automatically when certain conditions are met. I can provide a password, I just don't want to enter it every time Windows needs it. I have been reading in the meantime about RDP, but I found that it locks the machine for the local user when the session is closed. Do you know how can I avoid it?
  • Jakub
    Jakub almost 8 years
    Wow! Thank you for awesome response! I can't wait to test it as soon as I come back from work.
  • Jakub
    Jakub almost 8 years
    I have spend a fair amount of hours trying to connect to machine using RDP. After setting up reverse tunnel and configuring this service I am stuck at "Access denied" after entering password. I have been reading about editing domain group privileges but it is work computer so I don't have such permissions. Is there any way to connect using RDP with local administrator account?
  • Jakub
    Jakub almost 8 years
    It is professional. I have tried to login from different computer and I logged on, but all I see is black screen. Also, I had to unset enablecredsspsupport. There is working TeamViewer in the background. I wanted to add a sincere thank you for time you are spending to help me.
  • Vomit IT - Chunky Mess Style
    Vomit IT - Chunky Mess Style almost 8 years
    @Jakub Look over this article to configure allowing RDP access: technet.microsoft.com/en-us/magazine/ff404238.aspx. You will want to add the user account to the group it talks about which you want to allow the connection with even if it's a local account & not a local admin. I would go with the Select Allow Connections From Computers Running Any Version Of Remote Desktop to allow connections from any version of Windows. to start with as well. You may need to reboot the machine you're connected to remotely with RDP to see if that resolves the black screen issue.