Технология Wake on LAN (WoL) используется для удалённого пробуждения (включения) компьютера, который находится в спящем режиме (режиме пониженного энергопотребления). Сетевая карта компьютера инициирует процесс пробуждения компьютера после получение специального широковещательного пакета (magic packet) со своим MAC адресом. В этой статье мы рассмотрим, как настроить Wake on LAN на компьютере под управлением Windows.
В первую очередь нужно включить функцию Wake-on-LAN в настройках BIOS/UEFI компьютера. В зависимости от модели компьютера и версии прошивки название этой опции может отличаться. Она может называться:
- WOL (Wake-on-LAN)
- Power On By PCI-E
- Resume by PCI-E Device
- Resume by PME
- S4/S5 Wake on LAN
- ErP
На брендовых моделях компьютеров вы можете вывести и изменить настройки BIOS/UEFI с помощью PowerShell. Например, на ноутбуке Lenovo можно включить опцию WOL в BIOS командами:
$getLenovoBIOS = gwmi -class Lenovo_SetBiosSetting -namespace root\wmi
$getLenovoBIOS.SetBiosSetting("WakeOnLAN,Enable")
$SaveLenovoBIOS = (gwmi -class Lenovo_SaveBiosSettings -namespace root\wmi)
$SaveLenovoBIOS.SaveBiosSettings()
Затем нужно разрешить Wake on LAN (WOL) в настройках сетевого адаптера в Windows.
- Откройте диспетчер устройств (
devmgmt.msc
); - Разверните секцию Network Adapters и откройте свойства вашего физического сетевого адаптера;
- Перейдите на вкладку Advanced и проверьте, что опция Wake on magic packet включена (название может отличаться в зависимости от сетевой карты). В сетевых картах Intel эта опция может называться PME (Power Management Event);
. Можно с помощью PowerShell проверить, включены ли опции WakeOnLan в настройках сетевого адаптера:
Get-NetAdapter -Physical | Get-NetAdapterAdvancedProperty | where {($_.DisplayName -like '*WOL*') -or ($_.DisplayName -like '*Wake*')}
Чтобы включить WOL с помощью PowerShell в настройках сетевого адаптера, можно использовать такую команду (зависит от драйвера и венднодоа NIC):
Get-NetAdapter -Physical | Set-NetAdapterPowerManagement -WakeOnMagicPacket Enabled -WakeOnPattern Enabled
- Затем перейдите на вкладку Advanced и разрешите сетевой карте выводить компьютер из спящего режима. Включите опции Allow this device to wake the computer и Only allow a magic packet to wake the computer.
Можно включить эту опцию с помощью команды:
powercfg /deviceenablewake "Realtek PCIe GbE Family Controller"
Беспроводные Wi-Fi адаптеры также поддерживают удаленное включение. Этот стандарт называется Wake on Wireless LAN (WoWLAN).
С помощью следующей команды можно проверить, каким устройствам разрешено будить компьютер:
powercfg /devicequery wake_armed
В данном случае видно, что сетевой карте Realtek PCIe разрешено выводить компьютер из спящего режима.
Для работы Wake-on-LAN не нужно открывать дополнительный порты в Windows Defender Firewall. Широковещательный UDP пакет WOL (Magic Packet) принимается и обрабатывается непосредственно сетевой картой и не доходит до сетевого стека Windows.
Теперь, вы можете отправить WoL пакет для удаленного включения компьютера с другого устройства в той же локальной сети. Magic Packet содержит аппаратный адрес сетевой карты (MAC адрес), компьютера который нужно включить. Вы можете узнать MAC адрес сетевой карты компьютера из команды
ipconfig /all
или получить его с помощью PowerShell:
Get-NetAdapter -Physical
Вы можете сформировать и отправить широковещательный magic пакет WOL с помощью PowerShell. Укажите MAC адрес устройства, которое нужно включить в следующем скрипте и выполните его:
$Mac = "08:9e:01:6b:52:a2"
$MacByteArray = $Mac -split "[:-]" | ForEach-Object { [Byte] "0x$_"}
[Byte[]] $MagicPacket = (,0xFF * 6) + ($MacByteArray * 16)
$UdpClient = New-Object System.Net.Sockets.UdpClient
$UdpClient.Connect(([System.Net.IPAddress]::Broadcast),7)
$UdpClient.Send($MagicPacket,$MagicPacket.Length)
$UdpClient.Close()
Если вы все настроили правильно, удаленный компьютер должен проснуться.
Для работы WOL в сегментированных сетях или разделенных на VLAN, нужно включать пересылку широковещательных WoL пакетов (
UDP порт 9
) на уровне коммутаторов/маршрутизаторов.
Для удаленного пробуждения компьютеров можно использовать бесплатную Windows утилиту от NirSoft WakeMeOnLan. Утилита позволяет автоматически просканировать LAN и найти все доступные устройства, или вы можете вручную добавить устройства, которые вы хотите включать удаленно через WakeOnLan.
Утилита поддерживает режим работы из командной строки. Чтобы включить компьютер, нужно выполнить команду (утилита отрезолвит IP адрес в MAC по arp таблице):
WakeMeOnLan.exe /wakeup 192.168.31.15
Или по MAC адресу:
WakeMeOnLan.exe /wakeup 08-9E-01-6B-52-A2
Также можно использовать утилиты для смартфонов. Например, Wake On LAN для Android (для удаленного включения компьютера вы должны быть подключены к той же LAN через Wi-Fi точку доступа).
Если компьютер не включается после отправки пакета Wake-on-LAN, возможно нужно LAN нужно отключить быстрый запуск Windows в настройках электропитания (на моих двух тестируемых устройствах с Windows 10 и 11 это не понадобилось). Fast Startup включен по-умолчанию в Windows 10 и 11 и может препятствовать пробуждению компьютера через WOL (или вызывать ситуацию, когда компьютер не выключается после завершения работы Windows).
Откройте панель
powercfg.cpl
-> Choose what the power buttons do -> Change settings that are currently unavailable -> отключите опцию Turn on fast startup (recommended).
There is a command line version of WOL called WakeOnLanC.exe. It’s main purpose is to support the task scheduler, but it can be used for any reason to wake up and shutdown hosts just like the GUI. These are the command line options:
Command | Description |
---|---|
-s | shutdown, requires -m or -all |
-s1 | sleep, requires -m or -all |
-s4 | hibernate, requires -m or -all |
-r | reboot |
-w | wakeup, requires -m, -g, -mac, or -all |
use -mac and -agent to explicitly send WOL packet to specific IP |
|
-l | listen for WOL packets |
-e | enumerate host list |
-p “xx” | specify path to machines.xml database * this works on the GUI also |
-msg | immediate message (example -msg -c “Shutting down in 10 minutes” |
-pw “xx” | change shutdown password for a machine, requires -m, -g or -all |
-h | display help |
Options | |
-t xx | time delay (xx = seconds). For shutdown and reboot commands. |
-f | Force files closed. |
-m xx | xx = machine name |
-mac xxxx | MAC address |
-g xx | xx = a group to startup or shutdown. |
-all | All machines |
-agent xx | xx = address of WOL agent if on remote subnet, use with -mac |
-c “xx” | xx = popup message for shutdown or reboot command. |
Command line examples
Shutdown machine named “LaMachine”, the comment will be “Power Failure”:
C:\>WakeOnLanC -s -m LaMachine -c "Power Failure"
Wakeup machine named “LaMachine”:
C:\>WakeOnLanC -w -m LaMachine
Wakeup machine by MAC address:
C:\>WakeOnLanC -w -mac 00:43:18:9E:8E:A0
Reboot “LaMachine”, force files closed, delay for 20 seconds:
C:\>WakeOnLanC -r -m LaMachine -t 20 -f
Listen for and display WOL packets on the local subnet, for troubleshooting.
C:\>WakeOnLanC -l
Hibernate all machines.
C:\>WakeOnLanC -s4 -all
Wake-on-LAN (WoL) is a network standard that allows a computer to be turned on or awakened remotely using a special «magic packet,» which can be sent via the Command Prompt (CMD) using a script.
Here’s an example of how to use the `wolcmd` command in CMD:
wolcmd MAC_ADDRESS IP_ADDRESS SUBNET_MASK GATEWAY
Replace `MAC_ADDRESS`, `IP_ADDRESS`, `SUBNET_MASK`, and `GATEWAY` with the appropriate values for your network setup.
Understanding Wake on LAN
What is Wake on LAN?
Wake on LAN (WoL) is a networking standard that allows you to remotely turn on computers and other devices by sending a special network message, known as a «magic packet.» This functionality is particularly valuable for IT professionals, as it enables remote maintenance and file transfers without needing to physically access devices.
How Wake on LAN Works: At a technical level, WoL operates through Ethernet packets. When a machine is turned off, its network interface can still listen for these packets, which contain the MAC address of the device. Upon receiving the correct packet, the device will boot up, allowing for a range of automated tasks to commence.
Prerequisites for Using Wake on LAN
Hardware Requirements
Before utilizing Wake on LAN via CMD, ensure your hardware is compatible. Key requirements include:
-
Network Adapter Settings: The network adapter must support Wake on LAN. It’s essential to check the documentation of your network hardware to confirm compatibility.
-
Motherboard BIOS Settings: Access BIOS (Basic Input/Output System) to enable WoL functions. This feature is generally found under Power Management settings.
Software Requirements
Wake on LAN can be used with various operating systems, such as Windows, Linux, and macOS. Make sure that network configurations, including firewall and router settings, are correctly configured to allow WoL packets.
Mastering Python in Cmd: A Quick Guide to Efficiency
Setting Up Wake on LAN
Enabling Wake on LAN in BIOS
To enable Wake on LAN in BIOS, follow these steps:
-
Restart your Computer and enter the BIOS setup (usually by pressing F2, DEL, or ESC).
-
Look for the Power Management tab.
-
Enable Wake on LAN or similar options indicating network wake capabilities.
-
Save changes and exit the BIOS.
This process may vary slightly based on your motherboard, so consult your specific motherboard manual if necessary.
Configuring Network Adapter Settings
The next step is to ensure that the network adapter is set correctly within your operating system. Follow these steps in Windows:
-
Navigate to Device Manager by searching for it in the Start menu.
-
Locate your Network Adapters section and find your active network card.
-
Right-click and select Properties.
-
Under the Power Management tab, check the boxes for «Allow this device to wake the computer» and «Only allow a magic packet to wake the computer.»
-
Move to the Advanced tab and ensure options such as «Wake on Magic Packet» are enabled.
Example Command: To confirm which devices can wake your system, you can use:
powercfg -devicequery wake_armed
This command will list all devices capable of waking your computer.
Firewall and Router Configuration
Ensure your router allows WoL packets to pass through:
-
Access your router’s settings (often through a web browser at a specific IP address, such as 192.168.1.1).
-
Check settings for Port Forwarding. Open UDP port 9, which is commonly used for WoL.
-
Adjust firewall settings to allow traffic on the same port.
Master Python Run Cmd Like a Pro
Using CMD for Wake on LAN
Introduction to CMD Commands for WoL
Using Command Prompt (CMD) for Wake on LAN is efficient and offers precision. The command line allows users to run scripts for multiple devices quickly, making it an excellent tool for network administrators.
Basic CMD Command for Wake on LAN
The essential command used in CMD to issue Wake on LAN is the `wakeonlan` command.
Usage Example:
Suppose you want to wake up a device with the MAC address `XX:XX:XX:XX:XX:XX`, execute the following command:
wakeonlan XX:XX:XX:XX:XX:XX
This sends the magic packet to the specified MAC address, triggering the network hardware to wake the device.
Advanced CMD Commands and Parameters
In many cases, you might want to send magic packets to multiple devices simultaneously or automate the process with scripting.
Here’s an example using a batch script to wake several devices:
@echo off
for %%i in (XX:XX:XX:XX:XX:XX YY:YY:YY:YY:YY:YY) do wakeonlan %%i
This script will systematically wake devices based on their provided MAC addresses, optimizing management tasks and reducing time spent on manual inputs.
Troubleshooting Wake on LAN Commands
If WoL commands aren’t working, here are some steps to troubleshoot:
- Ensure the device’s network adapter and BIOS settings are correctly configured.
- Verify that the firewall and router settings allow WoL packets.
- Check if the device is in a low-power state that supports Wake on LAN.
To test network connectivity with the device, you may use the ping command:
ping -n 4 [IP address]
Replace `[IP address]` with the actual address of the device. This command helps ensure that the device is reachable in the network.
Trace in Cmd: A Simple Guide to Network Diagnostics
Additional Tools for Wake on LAN
GUI vs. CMD for WoL
While WoL command-line tools are powerful, several GUI applications exist that can simplify the process for beginners or those unfamiliar with CMD. These tools often come with user-friendly interfaces that can help automate WoL tasks without requiring command-line knowledge.
However, using CMD can be beneficial. It allows for more advanced scripting techniques and automation, making it more suitable for network professionals or those managing multiple devices.
Integrating Wake on LAN with Batch Files
Creating a batch file to automate Wake on LAN commands can save time and enhance efficiency. Here’s a simple batch file example:
@echo off
echo Waking up devices...
wakeonlan XX:XX:XX:XX:XX:XX
pause
This batch file will execute the wake command and then pause, allowing you to see the output before the window closes. You can customize the script to include multiple MAC addresses as needed.
Finding The Location Of Cmd: A Simple Guide
Conclusion
In this article, we explored the intricacies of Wake on LAN CMD. Understanding how to enable WoL in BIOS and network adapter settings, alongside the various CMD commands, empowers users to efficiently manage their devices remotely. With these tools at your disposal, you can streamline your network management processes and save valuable time.
This article will explain how to use the Shutdown command to turn off a computer remotely as well as how to use the WakeOnLan standard to wake or boot a PC.
How to remotely shutdown a computer on a LAN?
In order to control a computer remotely, please note that you must be connected to the same local network as the target PC. You must also know the username and password required for login.
- The first step is to open TCP port 445 on the target computer. To do this, open your Start menu and then go to Settings > Control Panel > Security Center.
- Open Windows Firewall and click the Exceptions tab.
- Select the line that reads File Sharing and printers and press OK. If this line is missing, click Add Port and choose TCP port 445 .
- Next, head to Start > Settings > Control Panel > System. Select the Remote tab and check the option that reads Allow users to connect remotely to this computer. It is now time to open the command prompt.
- Head to Start/Run or use the keyboard shortcut Windows + R. Next, type cmd and then hit OK. This will open your command prompt.
- To obtain the necessary rights to run a shutdown command on the target machine, you must first run the net use command. Use the Windows + R keyboard shortcut and then enter net use \\ip_address_of_target_machine. Enter an administrator username and password for the target computer to connect to the target PC.
- Once connected to the target PC, we can run the shutdown command. An example of the command is given below, whereby instructions are given for the target computer to close all active applications and shutdown after 30 seconds of inactivity. Please note that you can substitute any of the variables according to your network or PC specifics:
shutdown -s -f -t 30 - m \\192.168.3.4
-s: Shutdown the PC
-f: Force active applications to close without warning
-t xx: Set a countdown in seconds
-m \\xxx.xxx.xxx.xxx: The IP address of the target computer
The GUI is available by typing shutdown -i.
For any additional information about this command, type shutdown /?.
How to use the WakeOnLAN command?
WakeOnLAN, as the name already suggests, is a tool that can boot or wake a computer by sending a Magic Packet to the network adapter of the target computer. It is important to note that not all network cards and BIOS are compatible with, or support, the use of Magic Packet.
In order to use the WakeOnLAN command, you must be connected to the same local area network (LAN) as the target computer. Knowledge of the physical location (MAC) and IP address of the target computer is also required.
How to retrieve IP and MAC address?
- The first step is to retrieve the IP address and MAC address of the target computer.
- To do this, go to Start/Run or use the keyboard shortcutWindows + R and type cmd > OK.
- The command prompt will open. Now type ipconfig /all:
- Copy the IP and physical (MAC) address of the target PC.
How to perform the compatibility checks?
It’s now time to check if your network card is compatible with Magic Packets.
- To do this, right-click on My Computer and click Manage.
- Next, go to Device Manager/Network Cards and do a right-click on your Network Card.
- Then click Properties.
Do a search for the following words and verify that all options that relate to them are currently active: Magic Packet, Wake On Magic Packet, Wake On Lan, or Wake. If none of these words appear, you may be required to update the drivers for your Network Card.
- To see if your computer is BIOS compatible, enter the BIOS when you start the computer. You can do this by pressing ESC, F2, F5, F12 or DEL (depending on your system).
- Once in the BIOS, go Power Options and enable Wake-On-LAN, or any similar option:
How to open port 8900?
You can open Port 8900 in the same way as you would Port 445.
How to use Wake On LAN (WOL)?
Start by downloading the Symantec WOL tool on the source computer. Launch the tool and then fill in the empty fields using the information gathered above.
- Mac Address: MAC address (the target machine)
- Internet Address: Local IP address (target machine)
- Subnet Mask: 255.255.255.255
- Send Options: Local Subnet
- Remote Port Number: 8900
- Click the button: Wake Me Up
Once the packet has been received, the target computer will boot.
How to boot your PC from the Internet?
In theory, it is possible to boot a remote PC from the internet. You will need configure your router to redirect a UDP packet to a specific port on all the network computers.
By sending the magic packets to your public IP address (on the correct port), you will be able to individually boot computers on your local network.
How to boot your PC using your phone?
If you want to wake up your computer while you are not at home using your phone, you will need an external PSTN modem (using the RS 232 serial port). Connect the modem to your computer and enable the option in your BIOS. From there, you can connect the modem to IP phone line from your router.
Do you need more help with Windows? Check out our forum!
Skip to content
Wake-on-LAN (WOL) is a great feature of PCs which allows you to wake them up from sleep or shutdown over your local area network or over the Internet. It is like a remote power on button. If your hardware has WOL support, you can power on the computer remotely using any of the dozens of freeware tools available on the web to initiate the wake up event. In this article, I will cover the basic steps which are required to configure WOL under Windows 10.
That’s it.
Now you need to write down the MAC address of your network adapter somewhere. To see it, do the following.
- Open Settings.
- Go to Network & Internet -> Ethernet if you are using a wired connection. In case if your network adapter is wireless, go to Network & Internet -> Wi-Fi.
- Click your connection name and see the physical address of the adapter:
Note this value.
On another PC, download this little freeware app called WolCmd. It is my recommended command line utility which must be used according to the following syntax:
wolcmd [mac address] [ip address] [subnet mask] [port number]
So in my case, to wake up my own PC, I have to run it as follows:
wolcmd D43D38A6A180 192.168.0.100 255.255.255.0 9
While typing the syntax, just delete the «-» char from the MAC address and use your actual network parameters.
In case you don’t know what is subnet mask and your IP address, you can find them quickly by using the ipconfig command. Open a new command prompt instance and type ipconfig. The output will be as follows:
That’s it. Now you can create a shortcut to run wolcmd and wake up your PC via the network with one click.
Support us
Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:
If you like this article, please share it using the buttons below. It won’t take a lot from you, but it will help us grow. Thanks for your support!