Search code examples
powershelliiswindows-server-2012

How to setup IIS App Pool Cpu rate limit using powershell


I am trying to set cpu rate limit i was able to perform this action in UI using the action link

https://theitbros.com/set-cpu-usage-limit-for-an-application-pool-iis-8/

but i want to set three values below using powershell

CPU limit=20%
CPU limit Action= Killw3p
Cpu Limit Interval= 1

Iam already using powershell to setup startmode to always running.

set-itemproperty IIS:\AppPools\AddressBroker.API -name startMode -value AlwaysRunning

I have tried something like below but does not work.

set-itemproperty IIS:\AppPools\AddressBroker.API -name CPU -value Limit=20%

Solution

  • I figured out the correct command that works for me is below.

    C:\windows\system32\inetsrv\appcmd.exe set apppool AppPOOLName /cpu.limit:20000 /cpu.action:KillW3wp /cpu.resetInterval:00:01:00