I have a handful of workstations and a Windows Server 2008 R2 in the same LAN. The workstations show up in the server's Active Directory. Is there a way to wake them up manually from the server when they're powered off?
Asked
Active
Viewed 2.3k times
2 Answers
5
You can use Powershell to send a wake-on-lan magic packet from the server if the workstations are setup for WOL. This can also be used to wake the workstations at a specific time by running the script via the windows task scheduler if required.
Heres a sample script below from: http://gallery.technet.microsoft.com/scriptcenter/Send-WOL-packet-using-0638be7b
Usage:
Send-WOL -mac 00:11:32:21:2D:11 -ip 192.168.8.255 -port 7
Script:
function Send-WOL
{
<#
.SYNOPSIS
Send a WOL packet to a broadcast address
.PARAMETER mac
The MAC address of the device that need to wake up
.PARAMETER ip
The IP address where the WOL packet will be sent to
.EXAMPLE
Send-WOL -mac 00:11:32:21:2D:11 -ip 192.168.8.255
#>
param(
[string]$mac,
[string]$ip,
[int]$port=9
)
$broadcast = [Net.IPAddress]::Parse($ip)
$mac=(($mac.replace(":","")).replace("-","")).replace(".","")
$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
$UDPclient.Connect($broadcast,$port)
[void]$UDPclient.Send($packet, 102)
}

Alexander Lai
- 1,907
- 13
- 4
-
Your answer is better than mine. :) Upvoted accordingly. – Katherine Villyard Aug 14 '14 at 01:26
-
Any chance you have a Bash (Linux) version of that script kicking around? – jonathanbell Jun 09 '17 at 02:45
-
If anyone else is wondering what that crazy PowerShell syntax is doing: It creates a list of bytes that starts with 255 six times in a row, followed by the MAC address repeated 16 times. – Niko O Nov 27 '22 at 16:44
1
I can think of commercial products that do that--including Deep Freeze Enterprise and Altiris Deployment Solution--but I'm unaware of any such functionality built into Active Directory Users and Computers. Before buying something new, check the software you already own for this feature.

Katherine Villyard
- 18,550
- 4
- 37
- 59