top of page
  • Writer's pictureMarcel Venema

Wake-on-LAN with Powershell

A few weeks ago I wrote about my 4-node IKEA Besta server cluster. To preserve energy, I turn the nodes only on when I need the capacity. This is also good for our energy bill, I do not know how long I can persuade my wife that her hairdryer is responsible for all the electricity costs.

Anyway, I use a PowerShell script to send the Wake-On-LAN magic packet to the network card of the selected server. If you want to read more about the Wake-On-LAN functionality, see this Wikipedia article.

function Send-WOL




Send a WOL packet to a broadcast address


The MAC address of the device that need to wake up


The IP address where the WOL packet will be sent to


Send-WOL -mac 00:11:22:33:44:55 -ip









$broadcast = [Net.IPAddress]::Parse($ip)


$target=0,2,4,6,8,10 | % {[convert]::ToByte($mac.substring($_,2),16)}

$packet = (,[byte]255 * 6) + ($target * 16)

$UDPclient = new-Object System.Net.Sockets.UdpClient


[void]$UDPclient.Send($packet, 102)


send-WOL -mac 00-11-22-33-44-55 -ip

In order to function correctly, be sure the server BIOS Power Management EuP 2013 settings are set to disabled and in the Wake Up Event Setup configuration the Resume by Onboard LAN is enabled. Also on your hypervisor, be sure you enable Wake-On-LAN on your properties of the network card.

2,911 views0 comments


bottom of page