I have a PowerShell script:
& $psexec $serveraddr -u $remoteuser -p $remotepass -accepteula C:\Windows\System32\inetsrv\appcmd.exe list apppool /xml | C:\Windows\System32\inetsrv\appcmd.exe recycle apppool /in
that I am using to recycle all IIS pools. The problem is that only default, given from IIS pools are recycled. No private pools are recycled. They are not found by the second appcmd. First appcmd finds all pools, given by IIS and private.
Error is:
ERROR ( message:Nie można odnaleźć obiektu APPPOOL o identyfikatorze "Core1". )
from polish language it is:
ERROR ( message: Can't find object APPPOOL with id "Core1". )
I can't recycle private pools. Is there a way to bypass this?
So the second part of the command is executed locally. I've changed the script to recycle every each pool by single commands:
& $psexec $server -u $remoteuser -p $remotepass -accepteula C:\Windows\System32\inetsrv\appcmd.exe recycle apppool /apppool.name:Core1