Skip to content

Instantly share code, notes, and snippets.

@Zazcallabah
Created October 17, 2018 09:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Zazcallabah/aedc90f811d1c3239c08dabbc85dae1f to your computer and use it in GitHub Desktop.
Save Zazcallabah/aedc90f811d1c3239c08dabbc85dae1f to your computer and use it in GitHub Desktop.
Wake-on-lan trigger
param ([String]$mac = "00:11:22:33:00:11")
$MACAddr = $mac.split(':') | %{ [byte]('0x' + $_) };
$UDPclient = new-Object System.Net.Sockets.UdpClient
$UDPclient.Connect(([System.Net.IPAddress]::Broadcast),4000)
$packet = [byte[]](,0xFF * 6)
$packet += $MACAddr * 16;
[void] $UDPclient.Send($packet, $packet.Length)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment