Windows

Wake-On-LAN (WOL) with Windows and PowerShell

Wake-On-LAN is a networking standard that lets you wake up a computer from either a sleeping mode or a completely off mode by sending a network package through the network. It could be a very convenient technique to have in your daily work.

So how do we use it to wake up an off computer if that computer is equipped with the WOL capability?

The easiest and most effective way is to go through the network device that connects the computer to the network directly. If the network switch you are using is a manageable one, it usually offers a dashboard that allows you to send the Wake-On-LAN packets right from its port.

If not, the next available useful tool would be using PowerShell. This blog post from PDQ explains the details of how you can use PowerShell to send the Wake-on-LAN network packet through the network to wake up a sleeping computer.

In short, if you know the MAC address of a computer, you can use the following script to wake it up.

$Mac = "dc:4a:3e:76:43:e8"
$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()

It works great if a computer is directly connected to a network port on a switch on the same network. However, it would not be so effective if not. For example, if your computer is connected to the network through a VOIP phone, it would be less likely to be woken up by this method.

edge

Share
Published by
edge

Recent Posts

Disable Copilot on Windows 11 via Group Policy GPO

If using Copilot right from the Taskbar isn't your thing, you should disable it. Even…

8 months ago

Setting Default Fonts in Word, Excel, Outlook, and PowerPoint via Group Policy

In an environment where standardizing things does matter, setting default fonts in Microsoft Office apps…

9 months ago

How To Remove Restrictions Set in A Password-Protected PDF File

First of all, this is not to bypass a PDF file that requires a password…

9 months ago

How To Move My Outlook Navigation Bar Back From Left Back To the Bottom

Microsoft has been lurking about the idea of placing the Outlook navigation bar to the…

2 years ago

Headset with Microphone Echoing My Own Voice on Windows, What To Do?

One colleague came up to me the other day asking me to take look at…

2 years ago

How To Set Up Country-based IP Block on WordPress

If the amount of spam you get is out of control from your WordPress-based website,…

2 years ago