简体   繁体   English

局域网唤醒 Powershell 脚本不起作用

[英]Wake on LAN Powershell script not working

I've been trying to wake a computer on LAN from a shutdown state.我一直在尝试将 LAN 上的计算机从关机状态唤醒。 The computer that is sending the WOL request is a windows 10 machine and the machine i'm trying to wake is a Windows 10 machine.发送 WOL 请求的计算机是 Windows 10 机器,而我试图唤醒的机器是 Windows 10 机器。 I've tried a few scripts that I've found on the internet most of the scripts use the .net class UdpClient我尝试了一些我在互联网上找到的脚本,大多数脚本使用 .net 类UdpClient

I've made sure the computer I'm trying to wake has wake on LAN enabled on both the BIOS and the NIC.我已经确保我尝试唤醒的计算机在 BIOS 和 NIC 上都启用了 LAN 唤醒。

The network subnet I'm on is a 255.255.0.0 subnet.我所在的网络子网是 255.255.0.0 子网。 The IP adress is dynamic and is assigned via a DHCP server. IP 地址是动态的,通过 DHCP 服务器分配。

The Script I'm using is:我正在使用的脚本是:

WakeUp-Machines – A PowerShell script for Wake On LAN WakeUp-Machines – 用于局域网唤醒的 PowerShell 脚本

So far it's not waking from LAN, Any advice on where I might be going wrong or A script which is sure to work...到目前为止,它还没有从 LAN 中唤醒,任何关于我可能出错的地方的建议或一个肯定有效的脚本......

Cheers,干杯,

A Walter沃尔特

The script is working.脚本正在运行。 The problem was not with the script but with the computer receiving the magic packet.问题不在于脚本,而在于计算机接收到魔术包。 The problem was being caused by windows Fast Startup and it required me to turn this feature off.问题是由 Windows快速启动引起的,它需要我关闭此功能。

The article below outlines all the settings needed to enable wake on LAN.下面的文章概述了启用 LAN 唤醒所需的所有设置。

How to Enable Wake-on-LAN in Windows 10 如何在 Windows 10 中启用局域网唤醒

Thanks to Colyn1337 for their useful comment which lead me to solving my own problem.感谢Colyn1337的有用评论,这使我能够解决自己的问题。

Comment评论

Run the box you want to wake on lan and install a packet capture, like wireshark.运行要在局域网上唤醒的框并安装数据包捕获,例如wireshark。 Even though it's running, send a WOL request... does it show up in the pcap?即使它正在运行,发送 WOL 请求...它是否显示在 pcap 中? It's possible a network device between you is dropping the packet (quite common actually) – Colyn1337你们之间的网络设备可能正在丢弃数据包(实际上很常见) – Colyn1337

I had this problem, too.我也有这个问题。 On my dev machine the "Wake On LAN (MagicPacket)" app would wake the target machine, but none of the various PS1 scripts worked.在我的开发机器上,“Wake On LAN (MagicPacket)”应用程序会唤醒目标机器,但各种 PS1 脚本都不起作用。 But my dev machine was on the ASUS router's VPN.但是我的开发机器在华硕路由器的 VPN 上。 I stopped the VPN connection, ran one of the PS1 scripts, and it worked.我停止了 VPN 连接,运行了其中一个 PS1 脚本,并且成功了。
How can i improve the script to work even when my dev machine in on the VPN?即使我的开发机器在 VPN 上,我如何改进脚本以使其正常工作?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM