Send WOL packet using Powershell

This is a simple Powershell script to send a WOL packet to an IP address, which should be the broadcast address of the subnet where the device is connected to.

3.9 Star
66,122 times
Add to favorites
E-mail Twitter Digg Facebook
  • Use a public IP?
    1 Posts | Last post November 18, 2019
    • Could I put the public IP in the script instead of broadcast? And Just use a custom port in my router and script externally going to interal 7 on to the local IP of my computer. I have all BIOs and Windows OS settings set to allow WOL.
  • new to powershell
    3 Posts | Last post May 07, 2019
    • have downloaded the file to desktop; with powershell path pointing to my desktop, have tried 1) c:\users\test\desktop\ ./send-wol.ps1 -mac 00:24:1d:ae:79:cb -ip -port 9
      No errors; tried port 7; I don't event feel like I'm getting this to execute.  Would go a long ways if someone could point me in the right direction please.
    • - Is the appropriate broadcast address for your subnet?
      - Is the computer you are trying to wake on the same subnet as the computer from which you you are running the script? With no routers in the way?
      - Is WOL supported and enabled on the computer you are trying to wake?
    • This is a function so run the script without any parameters. Then there will be a cmdlet named send-WOL that you can run with the parameters. For example PS> send-WOL -mac 00:24:1d:ae:79:cb -ip -port 9
  • Thx for the script
    2 Posts | Last post March 09, 2016
    • I use it on a virtual Server 2012 R2 running RRAS and IPv4 Routing.
      The server is connected to a virtual external network that is bound to a NIC connected to the physical computer that I wanted to wake. The server is the default gateway in that network with IP
      I finally manage to send a WOL package to wake the physical computer by execute the function like this: 
      Send-WOL -MAC <MAC> -ip
      That way i managed to send the WOL package through correct NIC.
    • Thanks for the info.  I assume is the broadcast addresse.
  • Suggested improvement
    5 Posts | Last post September 09, 2015
    • Thank you sklaes, your default broadcast address is a very good suggestion. I have incorporated your suggestion.  
      Thank you once again and sorry for the late reply. 
    • Hey Barry,
      thanks for the replay! In my version of your script I made some more improvements. Your positive feedback persuade me to share it with the community:
    • I forgot to say it's not yet published - first i want your 'OK' 
    • Hi sklaes,
      As long as your work complies with the license ( MS-LPL ), you are welcome to use the code.  I appreciate if you could include the original source though. :)