I would like to have a delay between each recycled app pool so the CPU doesn't get high. Below is my current .bat file that recycles all my app pools at once. How can I add a delay between each one before the other gets executed?
%windir%\system32\inetsrv\appcmd list wp /xml | %windir%\system32\inetsrv\appcmd recycle apppool /in
Here is my output per a answer
<?xml version="1.0" encoding="UTF-8"?>
<appcmd>
<WP WP.NAME="8476" APPPOOL.NAME="8476.com" />
<WP WP.NAME="11636" APPPOOL.NAME="11636.com" />
<WP WP.NAME="8868" APPPOOL.NAME="8868.com" />
<WP WP.NAME="6180" APPPOOL.NAME="6180.com" />
<WP WP.NAME="5636" APPPOOL.NAME="5636.com" />
<WP WP.NAME="12616" APPPOOL.NAME="12616.com" />
<WP WP.NAME="7472" APPPOOL.NAME="7472.com" />
<WP WP.NAME="1668" APPPOOL.NAME="1668.com" />
<WP WP.NAME="9608" APPPOOL.NAME="9608.com" />
<WP WP.NAME="12480" APPPOOL.NAME="12480.com" />
</appcmd>
EDIT 2022/08/04: New code based on new posted data
The
appcmd list wp /xmlcommand outputs one XML file that contains several WP sections, one for each app pool, in this format:In this way, in order to execute each app pool cmd individually, we need to create individual well-formatted XML files. The Batch file below do so: