Michael McGovern
asked on
Start IIS sites in batches
Hello,
We host over 600 IIS sites and after a framework deployment by the Web Developers, the CPU goes through the roof after IIS is started. What we would like to do is start IIS, stop all the sites, then start them up in batches (for example, 50 at a time) to see if it helps with controlling the CPU usage. Could someone assist with a powershell script that will start up sites in batches?
Import-Module WebAdministration
Get-ChildItem -Path IIS:\Sites | foreach { Stop-WebSite $_.Name; } "Stops all sites"
We host over 600 IIS sites and after a framework deployment by the Web Developers, the CPU goes through the roof after IIS is started. What we would like to do is start IIS, stop all the sites, then start them up in batches (for example, 50 at a time) to see if it helps with controlling the CPU usage. Could someone assist with a powershell script that will start up sites in batches?
Import-Module WebAdministration
Get-ChildItem -Path IIS:\Sites | foreach { Stop-WebSite $_.Name; } "Stops all sites"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If this batching of site starts doesn't help, the next step would seem to be to find WHERE the high cpu was happening on IIS start. By that I mean simply what processes show up as high cpu in Task Manager.
We might presume it is the w3wp.exe for each site's app pool, but it may be different or otherwise helpful to know.
We might presume it is the w3wp.exe for each site's app pool, but it may be different or otherwise helpful to know.
ASKER
Thank you Jose for the script. It works like a charm.
Ohhh Nice!
I'm glad it worked :) I don't have any server with more than 10 sites on it hahaha
So I'm really glad it worked because it was untested I just simulated the results and then tried to make it work for your end :)
I'm so happy it worked like a charm and to help you! yeeey!
I'm glad it worked :) I don't have any server with more than 10 sites on it hahaha
So I'm really glad it worked because it was untested I just simulated the results and then tried to make it work for your end :)
I'm so happy it worked like a charm and to help you! yeeey!
Open in new window
To run it
Default, Stop all sites
Open in new window
Previous is the same but filling all parameters, Stop all sites (-div is not in use)
Open in new window
Final use (Starting 25 sites at the time)
Open in new window