What is the proper way to to automatically reboot a Windows Server?

I started this little venture maybe 15-20 years ago. All Windows Servers need to be rebooted every other week to keep them running right. I started out using a little utility called "Power Off" to schedule reboots on Sundays. It got to be too big of a pain. Mondays were horrible. The servers rebooted but there were several problems. Something about automatically rebooting that is different from the normal Start=>Shutdown=Restart. So many problems I gave up and went back to manually rebooting them.

   Fast forward 20 years.... I started using a MSP program called Ninja. It has a feature to reboot at a given time. I tried it and nothing has changed. Mondays are horrible. Backups don't run, VSS errors, DNS fails to start, etc, etc. The fix is the same. I have to to a Start=Shutdown=>Restart to get things working right again. So.... am I the only one that wants to automate the rebooting of Servers? Why isn't there a way to do an automated Start=>Shutdown=>Restart  when things actually come back properly?
LVL 15
LockDown32OwnerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

timgreen7077Exchange EngineerCommented:
I have never heard of anyone rebooting servers that frequently. but if you have alot of servers, I would suggest always bring up the AD, DNS, and DHCP server first, and then member servers.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JohnBusiness Consultant (Owner)Commented:
We do not do this at all. Patch Tuesday comes Monthly without fail. We restart when we run updates. No need to do weekly restarts from my perspective.

And I would not use a third part to do this either.
0
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
Never, ever, ever... Power off a server...

When you do this, you're almost guaranteed to corrupt all your databases.

This means when database starts next, a recovery process must be done to attempt bringing all databases back to a working state.

This can add hours of time to your database restart.

Most databases will start + then corrupt table repair will begin. If you attempt to access a corrupt table before it's repaired, behavior is undefined.

There will be a similar command for your version of Windows servers.

Also, I only mentioned databases. If you kill power, likely many other subsystems will end up with corrupt data, especially if you're doing this on a regular basis.

Only do a normal system reboot/restart to cycle machines. Never a power off or shutdown now (kill all processes so they can't sync their memory data to disk).
1
Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

LockDown32OwnerAuthor Commented:
I hate to say this but everyone is missing the question....

@TImgreen7077 the question wasn't what order to reboot them in. The question was how to "politely" reboot them with an automated routine.

@John the patching is automated and as you know after patching a reboot needs to be done. Once again the question is how to reboot a server "politely"

@David Favor I said nothing about powering off the server


Please focus on the question gents. Thanks.
0
timgreen7077Exchange EngineerCommented:
sounds like you already have an automated option, but if the servers come backup in the wrong order you can experience some of the issues you mentioned.
0
JohnBusiness Consultant (Owner)Commented:
Once again the question is how to reboot a server "politely"

Log people off and close programs (databases) either by having users do it (during day) or closing databases at night and restarting that way.

We supervise restarts because things can happen.
0
Phillip MonkIT ManagerCommented:
I'd like to second what the above comments state. Servers are made to run all the time without the need for periodic restarts. If you are having issues with particular services failing after a period of time, that is a separate issue that needs to be resolved. However, I'm here to answer the question you posted.

I'd recommend using the Task Scheduler.

Create a basic task in Task Scheduler to trigger on the day and time of your choosing. in the "Action" section put in:
c:\windows\sytem32\shutdown /r

Open in new window

You can configure additional options (like running as the admin, regardless if they are logged in) in the Advanced Options.

Simpler is always better.
1
LockDown32OwnerAuthor Commented:
@TimGreen7077 100% of these sites are single server. If they were multi-server I could schedule which ones came up first but since 100% of these are single server sites it is moot.

    @John the questions also states I want to do this automated.......
0
JohnBusiness Consultant (Owner)Commented:
We have several servers at a small number of sites and so supervised backups work well for us - just my experience here.

If I were automating it as you have done above, I would have it email me on a botched outcome (error code failure) so I could manage in advance of Monday Morning.
0
LockDown32OwnerAuthor Commented:
@Phillip Monk I will question your statement about servers being mean't to run forever. As John pointed out patch Tuesday comes along and some of those patches require a restart.....

So the shutdown /r will close databases, shut down programs and do things "politely"? in hopes of avoiding these oddities when the server comes back up?

I liken it to the APCC shutdown software (battery backup software in general). They seem to be able to shut things down "politely" before shutting down the server.....
0
Phillip MonkIT ManagerCommented:
Yes, 'shutdown /r' will give the signal to all running programs to terminate gracefully and will wait for their actions to be completed. It's identical to when you manually select the reboot option. I use it to restart remote servers when I'm logged in via RDC since you don't have that option (you are given "logout' instead).
0
LockDown32OwnerAuthor Commented:
The only thin I can find from the MSP on what their reboot does is:

Reboot

Utilizes WINAPI to run the'InitiateSystemShutdown' command.

Forced:
Adds the forced parameter, and executes after 5 seconds

Normal:
Does not add the forced parameter, and executes after 30 seconds.

So is the shutdown.exe and WINAPI the same thing? Based on the 30 seconds it appears to be. Is 30 seconds maybe not long enough?
0
Phillip MonkIT ManagerCommented:
A complete list of options and effects for shutdown.exe switches:
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/shutdown

I don't know of any difference between the WINAPI and the command line call. I would suspect they all call the same subsystem.

Normally the 30 second delay is to give any other users logged into the system a chance to save work. This command is universal across all Microsoft windows platforms. I know of no version of windows where this command does not apply. Again, I use this command on my production servers including my SQL servers when I'm remotely logged in.
0
LockDown32OwnerAuthor Commented:
That is interesting. I would agree it seems to be the same call. So.... I'll pick on SQL. It is a service isn't it? So the shutdown /r should shut down services gracefully? I somewhat tested it on a backup. The backup was running and the shutdown /r didn't stop it. So if the time (30 sec) is strictly to give users a chance to close and log off then all the services are shut down right before it reboots?
0
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
The shutdown will wait for services to stop. Only services not responding to the service manager are treated like applications not responding to Windows - and killed if using the force parameter. And that can cause corruptuon and data loss, of course.
0
Owen RubinConsultantCommented:
0
DanOwnerCommented:
can't you use the dos command shutdown?

task schedule as admin, then have a batch file like this

shutdown -r

that will restart the server.  Unless it's the same thing, it works for me, but I have limited needs.
0
LockDown32OwnerAuthor Commented:
That seems to be what I need to try. The MSP says it is doing a shutdown /r but things aren't rebooting right. Right now I have disabled the scheduled reboot altogether just to see if things work Monday. If they do I will bypass the MSP's reboot and try a shutdown /r
0
DanOwnerCommented:
close, it's shutdown -r

hifin, not a forward slash
0
LockDown32OwnerAuthor Commented:
That is interesting. I am on a Windows 10 workstation and a shutdown ? yields using the slashes....
0
DanOwnerCommented:
Ok, I learned something new, I guess you can do either....
0
DanOwnerCommented:
question, are you autologgin in when it comes back up?  if not, maybee the right services arent starting.
0
DanOwnerCommented:
I used Systernals auto login, and still do, I looked for a link to download it, and like all things Systernals, Microsoft bought it, some of their utilities they deleted, but It looks like autologin lived, and they changed it a bit.

https://docs.microsoft.com/en-us/sysinternals/downloads/autologon
0
LockDown32OwnerAuthor Commented:
Not logging back in. It simply reboots and goes back to the ctrl-alt-del screen
0
LockDown32OwnerAuthor Commented:
The MSP is doing something besides a simple shutdown /r. For now I have just removed the scheduled reboot to see it it is the source of the problem. If all the Monday morning problems go away I will script a shutdown /r.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows OS

From novice to tech pro — start learning today.