Created
March 10, 2022 21:50
-
-
Save rolambert/3da1c2082317e38d4a05e89e2309344d to your computer and use it in GitHub Desktop.
Powershell Magic Packet Wake on Lan Snipit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Mac = "00:11:8c:ee:80:aa" | |
$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