Automatic Server Shutdown
-
I would like that my Server (Windows 2003) automaticly shutdown at 20.00 and for it I think that the Best solution is to create a Net C# Windows Service, but could anybody tell me the C# command for getting the system down, I know that inside the Operating System the order is ShutDown but how to access the Operative System from inside the C# code, not existing shell orders as in older languages. Best Regards
-
I would like that my Server (Windows 2003) automaticly shutdown at 20.00 and for it I think that the Best solution is to create a Net C# Windows Service, but could anybody tell me the C# command for getting the system down, I know that inside the Operating System the order is ShutDown but how to access the Operative System from inside the C# code, not existing shell orders as in older languages. Best Regards
There are several alternatives on this SO thread[^].
Dave
If this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) -
I would like that my Server (Windows 2003) automaticly shutdown at 20.00 and for it I think that the Best solution is to create a Net C# Windows Service, but could anybody tell me the C# command for getting the system down, I know that inside the Operating System the order is ShutDown but how to access the Operative System from inside the C# code, not existing shell orders as in older languages. Best Regards
This may be a dumb question from me but why can't you just use the Task Scheduler to schedule a shutdown at the required time?
-
I would like that my Server (Windows 2003) automaticly shutdown at 20.00 and for it I think that the Best solution is to create a Net C# Windows Service, but could anybody tell me the C# command for getting the system down, I know that inside the Operating System the order is ShutDown but how to access the Operative System from inside the C# code, not existing shell orders as in older languages. Best Regards
Why would you need to write any code at all since you can just put a SHUTDOWN command line in a Scheduled Task job? Open a CMD prompt and type
shutdown /?
for the command line options.A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008
But no longer in 2009...