Use the same library AquilaWOL uses in your own custom applications. Just unzip the DLL and optional symbol files into your project.
/* send a WakeUp packet to host computer */ WOL.AquilaWolLibrary.WakeUp("00:0f:dd:0e:01:02");
/* shutdown computer "itchy" WOL.AquilaWolLibrary.Shutdown("itchy", AquilaWolLibrary.ShutdownFlags.Shutdown);
ShutdownFlags enum consists of the following options:
Logoff ForcedLogoff Shutdown ForcedShutdown Reboot ForcedReboot PowerOff ForcedPoweroff Sleep Hibernate
WakeUp options:
public static void WakeUp(string mac, [string network = "255.255.255.255"], [int udpPort = 9], [int ttl = 128], [string adapter = ""]) Summary: Send a WOL packet to a remote computer Parameters: mac: The MAC address to wake up network: The network broadcast address (optional) udpPort: WOL UDP Port (optional) ttl: WOL Time To Live (optional)
Shutdown options:
public static void Shutdown(string host, WOL.AquilaWolLibrary.ShutdownFlags flags, [string userid = ""], [string password = ""], [string domain = ""]) Parameters: host: The name or IP of the host flags: See "ShutdownFlags" userid: The optional userid to use for the shutdown connection password: The password, only used with userid. domain: The domain, only used with userid.
The library will throw an exception if the function all fails.