Script to Stop Application Pools on Windows

VB script to Stop Application Pools on Windows IIS 6

As  SysAdmin, We sometimes need to auto-stop some application pools in order to run a specific task like IIS logs cleanup.

This script will detect all application pools that are running and stop them.

myComputer = “.”
Set objWMIService = GetObject (“winmgmts:\\” & myComputer & “\root\microsoftiisv2”)
Set colItems = objWMIService.ExecQuery (“Select name from IISApplicationPoolSetting where AppPoolState = 2”)
For Each objItems In colItems
WScript.Echo poolname
Function AppPoolStop(PoolName)
set PoolcolItems = objWMIService.ExecQuery (“Select name from IISApplicationPool where name='” & poolname & “‘”)
For Each objItem In PoolcolItems
End Function
Enter that script in a text file, save it with extension “.vbs”. Copy it at C:\Windows\System32\
Run it manually or via a batch scheduler.
Thanks to Euk-marie. See the equivalent script by Euk-Marie to start the App Pool at

We know you like Sports and Geeky things, We do too, but you should build the skills that’ll drive your career into six figures. Cloud skills and certifications can be just the thing you need to make the move into cloud or to level up and advance your career. 85% of hiring managers say cloud certifications make a candidate more attractive.

Download the Djamga App for ios or android or Microsoft for drop in soccer, basketball, volleyball, badminton, football, hockey, cricket games details and location in your city.
error: Content is protected !!