Create Application Pool using WMI


Here is an code snippet that creates application pool [here for example MSSharePointAppPool application pool] using WMI Script.



strComputer = “.”

Set objWMIService = GetObject(“winmgmts:{authenticationLevel=pktPrivacy}\\” & strComputer & “\root\microsoftiisv2”)

Set colItems = objWMIService.ExecQuery(“Select * From IIsApplicationPool Where Name = ” & “‘W3SVC/AppPools/MSSharePointAppPool'”)


For Each objItem in colItems

objItem.Start

Next


Supported Platform: Windows Server 2003