send magic packet from windows with one click

10k Views Asked by At

WOL works perfectly well via the Router, but that requires logging in to the control and browse trought the menus. I want to wake up the machine with one (double) click.

I tried

Both throw Syntax Errors, wether I try them with cmd or the PowerShell.

Bash one-line command to send wake on LAN magic packet without specific tool probably works in linux, but definitely not on windows

Is there a one-liner for Windows or anything that I can put in a bash batch file that actually works?


edit:

I got the second script to run (rename to .ps1, changed execution policy in PowerShell), but not to work.

Tried https://www.itnator.net/wake-lan-script-wol/ but this throws an exception:

Send-Packet : Ausnahme beim Aufrufen von "Parse" mit 1 Argument(en):  "Die angegebene physikalische Adresse ist
ungültig."
In C:\wol-script.ps1:38 Zeichen:1
+ Send-Packet <mac-address>
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Send-Packet

Fehler beim Durchlaufen einer Auflistung: Die Sammlung wurde geändert. Der Enumerationsvorgang kann möglicherweise
nicht ausgeführt werden..
In C:\wol-script.ps1:29 Zeichen:3
+         $Error | Write-Error;
+         ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Collecti...numeratorSimple:ArrayListEnumeratorSimple) [], Runt
   imeException
    + FullyQualifiedErrorId : BadEnumeration
1

There are 1 best solutions below

0
Titus On

https://www.gammadyne.com/cmdline.htm#wol works, and it´s "only" 193K (go-wol is around 5MB).
I will put a batch script around it and then I´m done.
A deep link into the router setup would be smaller, but I guess that the AVM software does not allow that.

Only wish remaining is to hibernate the machine via Magic Packet, but my NIC is probably too old for that. I think I will use PuTTY for that.

Thanks everyone for digging!