My organization has 600 sites and subsites in 4 different site collection. We run Sharepoint Warm up Script at 3 am in the morning to make sure users all set to go at the morning. Recently i have been encountered with failed SharePoint Warm Up Script with 6-7 sites regularly. They Fail at 3 am in the morning and they fire off again at 8 am in the morning(for scheduler that has been scheduled to fire off).
Dont know why this is happening.
Here is the code :