Script to restart server when no user is remotely connected

I'm looking for something special : here is a windows server that is used for development by 4/5 people remotely working on it through remote control.

I'm installing Visual Studio 2010 on it, and the installation won't continue until the server has been restarted. I'm looking for a way to reboot when the server is idle (when nobody is connected through remote desktop on it) so that the reboot doesn't bug anyone.

Is there some software that can do that ?

Thanks !


Here's a script:

  1. Find out what time none of the developers are likely to be logged in. For this example we will use 3 am through 7 am as the time that no developers are expected to be logged in.
  2. Email the developers and inform them the server will be rebooted at 3 am.
  3. Reboot the server at 3 am.

You could probably script this in either Powershell or Batch and then run a scheduled task every 5 minutes to check and then reboot if possible. Try the command "quser". But you'll need to test this etc.

So, with that said, you have 5 users. Just tell or ask them - you're far more likely to bug them by suddenly bouncing the server as they're about to log on, or if they've just logged off for a minute.

Also, make sure you check for disconnected sessions and not just active users


This is one of those situations when you doing your job disrupts someone else doing theirs and vice versa.

Sure you could burn many hours trying to figure out a technical solution, but talking to each other and finding a suitable time will be cheaper and more easy to sustain in future.

If they really need zero downtime, then you need to know so you can invest in that, since there may also be costs related to unplanned outages that are unacceptable. If they aren't bothered about that, then they should not be demanding you don't do your job!