首页 电脑 电脑学堂 查看内容

powershell远程唤醒系统

2011-5-10 10:36 760 0

摘要:   从MS官方blog上看到一则很实用的脚本,用来远程唤醒系统  1、确认你的系统是否支持远程唤醒  #ethtool etho|grep ‘Wake-on’  Supports Wake-on: p...
关键词: 192.168 1.188 MagicPacket UdpClient Wake MacAddress bytes xFF 系统 脚本

  从MS官方blog上看到一则很实用的脚本,用来远程唤醒系统  1、确认你的系统是否支持远程唤醒  #ethtool etho|grep ‘Wake-on’  Supports Wake-on: pumbag  Wake-on: g  g 表示已启动  2、编写脚本  ########################  param($MacAddress)  echo “Wake up $MacAddress Now!”  [byte[]] $MagicPacket = 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF  $MagicPacket += ($MacAddress.split(‘-’) | foreach {[byte] (’0x’ + $_)}) * 16  $UdpClient = New-Object System.Net.Sockets.UdpClient  $UdpClient.Connect(([System.Net.IPAddress]::Broadcast) ,9)  $UdpClient.Send($MagicPacket,$MagicPacket.length)  ########################  保存为wakeup.ps1  3、测试  PS D:\programme\powershell> ping 192.168.1.188 -n 1;.\wakeup.ps1 00-16-11-11-11  -11;ping 192.168.1.188 -n 3  Pinging 192.168.1.188 with 32 bytes of data:  Request timed out. <<—-系统处于挂起的状态  Ping statistics for 192.168.1.188:  Packets: Sent = 1, Received = 0, Lost = 1 (100% loss),  Wake up 00-16-d3-c6-bd-25 Now!  102  Pinging 192.168.1.188 with 32 bytes of data:  Request timed out.  Reply from 192.168.1.188: bytes=32 time=1ms TTL=64  Reply from 192.168.1.188: bytes=32 time<1ms TTL=64 <<—-成功
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系 [邮箱地址] 删除

路过

雷人

握手

鲜花

鸡蛋

最新评论

返回顶部