WDS service on SCCM 2012 secondary site server - Restart

Hi Experts,
Can you please assist, our 2 secondary SCCM Site Servers which services PXE request often has the WDS service "lock up"/hang following a reboot storm, these SCCM Site servers services PXE request for around 4200 clients, we have a scheduled workstation restart on at 3am on Sunday morning, which causes the service to trip up, we'd like to understand why and resolve once and for all why this is happening, as the Secondary site servers are decently spec'd, and 4200 clients is split between these 2 servers should be able to handle the load,  
The only way around this is manually restart the WDS service at that time of the morning, failing to do so will cause clients to stall on restart, we need to automate restarting this WDS service,
Given we know that the service will trip over between 3-3h30am on a Sunday morning, is there any automated way either via a PowerShell script, or scheduled task etc that we can restart this service at a set time?
Craig PaulsenSenior Systems EngineerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

Nagendra Pratap SinghDesktop Applications SpecialistCommented:
Try making a batch file like this and scheduling it
======================
net stop wdsserver

timeout /t 60

net start wdsserver
===================

Scheduling help is here (lower part)

https://www.e-education.psu.edu/geog485/node/143
Craig PaulsenSenior Systems EngineerAuthor Commented:
Thank you nagendra, will check out in the morning,
Craig PaulsenSenior Systems EngineerAuthor Commented:
thanks,
I've created a script as follows, based on an article I came across
_________________________________________________________________________________________
SET    "SERVICE=WDSServer"
SET /A "MAXUSAGE=60"
SET /A "INTERVAL=300"

:LOOP
For /F %%P in ('wmic cpu get loadpercentage ^| FINDSTR "[0-9]"') do (
    IF %%P GTR %MAXUSAGE% (
        Echo [%TIME:~0,8%] CPU Usage: %%P%% Reached the limit: %MAXUSAGE%%%
        Echo Restarting %SERVICE% ...
         SC STOP  "%SERVICE%" 1>NUL
      timeout /t 60
        SC START "%SERVICE%" 1>NUL
        Echo Service restarted.
    ) ELSE (
         Echo [%TIME:~0,8%] CPU Usage: %%P%%
    )
)
Ping -n %INTERVAL% Localhost >NUL
GOTO :LOOP
____________________________________________________________________________________________________________

works well for the most part, however there are occasion's that because the WDS service get's thrashed as a result of this reboot storm, the service doesn't start up if you attempt to stop start the service,
Only way around this is to reboot the server, is there anyway I could add in some commands that will restart the server if this eventuates?
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

Nagendra Pratap SinghDesktop Applications SpecialistCommented:
What is reboot storm ? Do you have 500 machines rebooting in the same time?

Can you stagger it to like 100 X 5 spaced 5 mins each?

I suggest you stagger the boot of the workstations by using something like this.

http://stackoverflow.com/questions/22941468/how-do-i-schedule-a-task-at-a-random-time-via-batch-file
Craig PaulsenSenior Systems EngineerAuthor Commented:
thanks Nagendra, reboot storm is the weekly reboot of our fleet of workstations, around 4500 machines :); this happens weekly at 3am on a Sunday morning

the plan is to eventually manage these reboots via SCCM, and stagger them accordingly,
for now, the current situation is such that there is a GPO configured in the environment which set's a scheduled task on client workstation, and this triggers the weekly reboot at 3am in the morning for workstations,
We would first need to script the removal of this scheduled task from workstations, disable the GPO,
then create the SCCM package to manage the reboots, the latter we require some thoughts as we want to build in some smarts into the SCCM managed reboot process, which will require some thought/planning/testing etc,
For now, we just want to manage the current situation, and that is either restart that WDS service automatically, or restart the servers where the WDS services runs on to get around this issue of WDS locking up,
Nagendra Pratap SinghDesktop Applications SpecialistCommented:
Does WDS help them get up or something similar?

I guess if WDS does not respond then they still boot up after say 2 mins, right?
 
You should stop WDS for like 30 minutes and then start it at 3:30. By that time all machines would be up and not trying to contact WDS.
Craig PaulsenSenior Systems EngineerAuthor Commented:
yes, 90% of the workstation fleet boot order configured to network boot first, when WDS service stalls, the workstation boot stalls, and users need to press escape to get around this, which can be annoying to end users, and results in our helpdesk getting flooded with calls,
I like the idea of stopping the WDS service for 30 mins, then starting it up again, the problem is that sometimes the WDS service doesn't start up and we have restart the entire server to get it going again,
trying to integrate this into my script somehow.
Nagendra Pratap SinghDesktop Applications SpecialistCommented:
lets see how it goes.

Perhaps you can install SCOM as your environment is fairly large (For NZ standards).

BTW I lived in Auckland for 2001-2009.
Craig PaulsenSenior Systems EngineerAuthor Commented:
it is large environment by NZ standards yes, SCOM not optional as we use NAGIOS for monitoring,
unfortunately stopping the WDS service for 30 mins did not work, so I'm back to square one,
I think the approach I will take will be to create a schedule to task to just restart the server at a set time.,
Nagendra Pratap SinghDesktop Applications SpecialistCommented:
Seems OK to reboot it at that time.

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
Craig PaulsenSenior Systems EngineerAuthor Commented:
Thanks for your help though
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 Server 2012

From novice to tech pro — start learning today.