A guide on how to remote lock computers on the network with one batch file

johncoool2

Senior Member
This method works on Windows 10, 8.1 & 7 as well.

All programs for this guide are free.

Download links

PsTools


PsTools - Windows Sysinternals

FePsTools

Front-end for PsTools | DaviTools

Nircmd (At the bottom of the page. Not the 64 bit one.)

NirCmd - Windows command line tool

Winrar

WinRAR Download Latest Version

--------------------------------

Nircmd: Used to run system commands.

Winrar: Used to extract the downloaded compressed files if another one is not available already.

PsTools: Are Microsoft tools to remote execute commands on other computers.

FePsTools: Is a third party tool to create the commands and shortcuts for PsTools.

--------------------------------

Extract Nicmd files and add them to C:\windows\system32 folder. (If it gives an error then extract the contents to a folder that you create on the desktop then copy the contents to that location).

FePsTools program is not needed for remote execution to work but I found that it increases the chance of success because sometimes some commands don’t work as well with just PsTools on different Operating Systems.

--------------------------------

If you get access denied then you will need to enable the local administrator account on the target computer and use the credentials for it to work. You will still use your normal account but now you will have one more account on the login screen.

To enable the local administrator then right click on cmd and run it as administrator then run the below command:

net user administrator /active:yes


Then go to users in control panel and manage the account to create the password (Blank passwords don’t work). No need to log into the administrator account to continue. (If you do get any other problems then logon to the administrator account then back into your normal account).

Extract the FePsTools into any permanent location and extract the PsTools and move the Psexec.exe file into the FePsTools directory. FePsTools does work with other tools from PsTools including remote locking the PC, but it did not work during testing so we will only be using the Psexec.exe tool.

To create a batch file just create a text file and change the extension from .txt to .bat. To edit a batch file, just click on it with the mouse right button and select edit.

The FePsTools will allow you to create shortcuts for the commands.

The below image shows the fields that need to be filled in.

1.png


For one Client PC. Add the computer name or IP address along with the Administrator username and password. It is recommended to use computer name instead of IP address because sometimes the IP address can change. (IP addresses can be reserved from the main router for each PC so that it does not change).

Fill in the commands as showing in the below image.

3.PNG


The Command in the below image will mute the remote PC.

10.PNG


To create a shortcut for the command then use the button shown in the below image.

4.png


To test the command from the FePsTool then use the button shown in the below image.

5.png


The button with the X on it is to stop the command from running.

Creating a shortcut will only work to Run one command for one computer.

To create it for multiple computers then Create each shortcut and save it in a permanent directory. Then use a batch file to run all of them at once.

The below is an example of a batch file. It will just include the command to run the shortcut from its location (This is for three commands). File and folder names do not matter so that the commands work. Just make sure that the location of each one is correct when typing it in. Use the quotation marks as showing in the below example.

The timeout command is not required. Use it if it seems that some commands are not working. The number is time in seconds.

Run Batch file as Administrator

@echo Off

Start "" "D:\any\one.lnk"
Timeout /T 1
Start "" "D:\any\Two.lnk"
Timeout /T 1
Start "" "D:\any\three.lnk"

Other requirements

File and printer sharing needs to be allowed through the firewall as showing in the below image.

6.png

It also needs to be enabled on LAN adapter. (It is on by default so check it if it has been disabled by you before)

7.png


EXTRA TIPS

Keep the created files and folders as is so that all works well. If you move or rename something then it might need to be recreated.

If you get the error that Admin$ share is not working then open the computer management and check that they are enabled.

If you get on IPC$ then there is an issue with it like is showing below.

9.PNG


This is an example of the standard share being enabled. You might have different partitions showing in your log.

8.png


Some programs like AVG Tuneup give the option to disable option to disable it. You can re-enable it from there or by using one of the below methods.

Microsoft solution.


Or download Winaero Tweaker from the below link and search for Administrative Shares (also called Network /Administrative Shares) and enable them and then restart the PC.


If you have issue while pinging by hostname and get response from IPV6 instead of IPV4 then use the below instructions to get it fixed and back to normal.

Open a cmd (Command Prompt) as an administrator and run the two following orders:

netsh interface ipv6 set prefix ::/96 60 3

then

netsh interface ipv6 set prefix ::ffff:0:0/96 55 4
 
Last edited by a moderator:

johncoool2

Senior Member
Different people have different requirements.

I use it all the time. I share accommodation with others and sometimes need to leave in a hurry. So I need to lock all my computers quickly. I have it setup to work with Windows Task Scheduler to execute as soon as the main workstation is locked but this has a con and that is why I did not include it in my guide (If the main computer locks after the idle time is up then it would lock the other computer if I am using it at that time).

There is the option to lock computer when on idle after X amount of minutes but that is not convenient for me because I want to make sure that it is more secure than that and that all my data is always secure.
 
Top