Wake-On-LAN multiple computers at once!

Wake-On-LAN multiple computers at once!

If you need to turn on or awake several computers at once, or perhaps, just need to do it remotely, whether they are near or far away, the Wakeup-On-LAN feature is a fantastic method.

Wakeup-On-LAN turns on a computer when it receives network special message, called a “Magic Packet” .

The first step is to verify if the target computer and network cards have Wakeup-On-LAN, and also turning it on.

Check in the BIOS of your computer and ensure the feature is active.

For Windows 10, its also necessary to enable the “Wake on Magic Packet” and update the power settings for the network adapter in the properties tab.

Its also necessary to use a special application that will send the “Magic Packet” throught the Command Line or batch script. In a previous post, I mentioned a free application created by Depicus, called Wake On Lan Command Line. Its available through this link.

Place the application in a folder of your choice,and update the path in the script. Its also necessary to add the IP or computer name, MAC address, subnet mask and port in the correct fields. The whole script below is designed to turn on 3 computers. Run it and the computers should turn on.

If you place the batch script in the Windows 10 startup folder, the script will run every time you turn on and login to one computer.

REM License: GNU General Public License v2.0
REM Author: Miguel
REM Website: www.techlogist.net
REM Post: https://techlogist.net/batch/wake-on-lan-multiple-computers-at-once/
REM Description: Wakes up the computers on LAN
REM OS/Language/Region: Windows/EN-US
REM Links for the application you need:
REM https://www.depicus.com/wake-on-lan/wake-on-lan-cmd
:_start
REM Start of script
@echo off
cls
title Wake-on-LAN Sklep v1
color f0
mode con:cols=70 lines=15
goto _set_variables
:_set_variables
REM Set the computer name or IP, MAC with only HEX and without separators, subnet and port
REM One set per computers. Also add the machine later in the script
cls
set computer1_ip=
set computer1_mac=
set computer1_port=
set computer2_ip=
set computer2_mac=
set computer2_port=
set computer3_ip=
set computer3_mac=
set computer3_port=
set subnet_mask=
goto _set_folders
:_set_folders
REM Set the folders to be verified
cls
set _WolCmd-app=C:\Program Files\WolCmd\
goto _WolCmd
:_WolCmd
REM Set the WolCmd.exe path as a variable
cls
cd "%_WolCmd-app%"
REM Check if WolCmd.exe is available
IF EXIST "%_WolCmd-app%\WolCmd.exe" (goto _wake_computers) else (goto _WolCmd_unavailable)
goto _WolCmd
:_WolCmd_unavailable
REM The error screen for WolCmd is missing
color 47
cls
echo ----------------------------------------------------------------------
echo.
echo.
echo.
echo.
echo.
echo WolCmd is unavailable. Please install
echo.
echo.
echo.
echo.
echo.
echo ---------------------------------- ----------------------------------
pause
color f0
goto EOF
:_wake_computers
REM Run the tasks
color f0
cls
echo ----------------------------------------------------------------------
echo.
echo.
echo Wake-On-Lan Computers
echo.
echo
echo.
echo
echo
echo
echo.
echo.
echo ---------------------------------- ----------------------------------
goto _send_wol
:_send_wol
REM Send the signal
cd "%_WolCmd-app%"
REM Trying to wake computers
wolcmd %computer1_mac% %computer1_ip% %subnet_mask% %computer1_port%
timeout /T 3
wolcmd %computer2_mac% %computer2_ip% %subnet_mask% %computer2_port%
timeout /T 3
wolcmd %computer3_mac% %computer3_ip% %subnet_mask% %computer3_port%
timeout /T 3
:EOF
REM Exit the batch
cls
exit