Hey everyone. I created a working Wake On Lan script via Python, using MagicPacket. The script will ask the user input of first a MAC Address. There are safeguards in place which forces the user to input a valid MAC Address. Currently, you can only seperate the MAC Address hexadecimal characters by a dash (-) or a colon (:), and not a dot (.). After a valid MAC Address is inputted, the script will ask the user to input a Private IP Address. Once again, there are safeguards in place to assess whether the inputted IP Address is valid and not a Public IP Address. Afterwards, if everything is inputted correctly, it will send a Magic Packet and should wake up the targetted machine!
Everything is open source and you're more than welcome to code it so that it will permenantly do one MAC Address and IP Address only.
pip install wakeonlan
pip install termcolorImportant to note: Wake on LAN may not work with Fast Startup enabled. Make sure to disable it. (sometimes it worked on my computer when enabled, but I found it works 100% of the time when it's off)
How to Manually Disable Fast Startup:
- Navigate to the Control Panel and select ‘Power Options.’
- Choose ‘Choose what the power buttons do.’
- Click on ‘Change settings that are currently unavailable.’
- Under ‘Shutdown settings,’ uncheck the ‘Turn on fast startup’ box.
When you shut down your computer, it matters if it is shutting down in S3 (sleep mode), S4 (hibernate) or S5 (soft power off mode). According to Microsoft, WoL only works with S3 or S4. It does not work with fast startup or soft shut off (S5).
- Did you enable Wake on LAN in BIOS? Double check to make sure that
Resume by PCI/E or WakeOnLAN is enabled - In Device Manager, under Network adapters, select your network device.
- Click Properties --> Advanced --> Under the Property section, select
Wake on Magic Packetand select Enable in the value box. You should also enableWake on magic packet when system is in the S0ix power state - Open the Power Management tab
- Enable
Allow this device to wake the computerandOnly allow a magic packetto wake the computer.
https://stackoverflow.com/questions/7629643/how-do-i-validate-the-format-of-a-mac-address
https://pypi.org/project/wakeonlan/
https://serverfault.com/questions/1018470/wol-and-wow-does-not-work-after-a-certain-time
https://www.lifewire.com/wake-on-lan-4149800