Skip to content

Instantly share code, notes, and snippets.

@EinPinsel
Created December 31, 2016 13:56
Show Gist options
  • Save EinPinsel/b04389c3a8b0ed08d1b0b2b788ace76a to your computer and use it in GitHub Desktop.
Save EinPinsel/b04389c3a8b0ed08d1b0b2b788ace76a to your computer and use it in GitHub Desktop.
$Mac = "1A:2B:3C:4D:5E:6F"
$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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment