ent*_*nio 3 active-directory wake-on-lan windows-server-2008-r2
我在同一个局域网中有一些工作站和一个 Windows Server 2008 R2。工作站显示在服务器的 Active Directory 中。有没有办法在关闭电源时从服务器手动唤醒它们?
小智 5
如果工作站是为 WOL 设置的,您可以使用 Powershell 从服务器发送网络唤醒魔法数据包。如果需要,这也可用于通过 Windows 任务调度程序运行脚本来在特定时间唤醒工作站。
下面是一个示例脚本:http : //gallery.technet.microsoft.com/scriptcenter/Send-WOL-packet-using-0638be7b
用法:
Send-WOL -mac 00:11:32:21:2D:11 -ip 192.168.8.255 -port 7
Run Code Online (Sandbox Code Playgroud)
脚本:
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)
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
19736 次 |
最近记录: |