Wake-on-LAN.ps1
: a Wake-on-LAN PowerShell script
Wake-on-LAN.ps1
PowerShell script for sending Wake-on-LAN magic packets to given machine's hardware MAC address
This script originated is a modification [Wayback] WakeUp-Machines.ps1
by Matthijs ten Seldam, Microsoft that has the drawback of requiring a text file with the machines to wake up, and (before his change) the original reliance on the above mentioned [Wayback] WolCmd.exe
in the current directory.
[Wayback] Ammaar Limbada modified it to take a hardware MAC address on the command-line, but unlike the [Wayback] Perl wakeonlan
script that is available for most Linux and BSD systems, it was limited to Windows and pure hex (Intel Landesk) formatted hardware MAC Addresses.
wakeonlan
supports these formats or "notational conventions":
xx:xx:xx:xx:xx:xx
(canonical)xx-xx-xx-xx-xx-xx
(Windows)xxxxxx-xxxxxx
(Hewlett-Packard switches)xxxxxxxxxxxx
(Intel Landesk)
Goal is to have this script support all of them too (:
At line 67, instead of splitting the raw string by certain characters and then joining it back, it would be better just to remove all non-hex characters:
$BareMacAddressString = $MacAddress.ToUpper() -replace '[^A-F0-9]'