Click here to Skip to main content
15,902,885 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI!
I want a code in C# to automatically shut down all computers in a network at a specified time, (i.e.scheduled shut down). I will be grateful if someone can guide me to any helpful material which i can study and consult to define daily logon quota for all users in a campus lab so that they can use computers for a specified period of time only and not when that duration expires.
Posted

I advise you to NOT shut the computers down, but to simply log them off.

To implement this, I would write a Windows service and install it on all of the lab's PCs. If you wanted to get really fancy, you could maintain a database on a server somewhere used to both store c0onfiguration info (regarding max time allowed to be logged in, etc) and to collect usage info on a user-by-user basis.
 
Share this answer
 
You can make use of Win32ShutDown method in the Win32_OperatingSystem class to shut down the remote computer. You can have a timer set which would track the start up of the remote computer and shut down after the time is over.

To track the start time of a remote computer, use LDAP. Check the lastLogonTimeStamp[^] to get the login time. DirectorySearcher class will help you in getting that value.

IMO, instead of having a program running on one computer monitoring all the computers, have a simple application running on all the computers. This application should start at the log in and would shut the computer down after the allotted time is over.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900