Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C#: Startup a computer programmatically at a given time

Tags:

c#

.net

startup

How do I startup a computer from C# code at a given time?

This should be done locally from the computer that is to startup, but other alternatives can be interesting.

Are there any prerequisites to get this to work? Like the computer has to just be in sleep mode, not shut down?

like image 543
Seb Nilsson Avatar asked Jul 09 '26 05:07

Seb Nilsson


1 Answers

you can do this by scheduling a task, don't think you can have a program running which will wake the computer at a specified time. The computer must be sleeping for it to be woken, not off.

you best bet is to write a command line app and schedule this to be kicked off using the scheduler.

Your other option is wake on lan and have a program on another machine send a magic packet to the machine you want to wake up.

I'm not sure if there are any standard libraries that allow you to create scheduled tasks in .net but this code project project seems to try and do it.

like image 123
Sam Holder Avatar answered Jul 11 '26 19:07

Sam Holder



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!