Powershell remote wake-up system

Source: Internet
Author: User
You can see a very useful script on the MS official blog to remotely Wake up the system. 1. check whether your system supports remote wakeup. # ethtooletho | grep 'wake-on 'ortortswake-on: pumbagWake-on: gg indicates it has been started. 2. write a script ####################### param ($ Mac

The official MS blog shows a very practical script to remotely wake up the system.

1. check whether your system supports remote wakeup.


# Ethtool etho | grep 'ake-on'

Supports Wake-on: pumbag

Wake-on: g

G indicates that the instance has been started.

2. write scripts

########################

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)

########################

Save as wakeup. ps1

3. test

Ps d: programmepowershell> 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. <-- the system is suspended.

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 = 1 ms TTL = 64
Reply from 192.168.1.188: bytes = 32 time <1 ms TTL = 64 <-- success

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.