error trying to recycle app pools with a vbscript

0

Can any one tell me why I am getting an error message with this code: I am trying to recycle app pools with a wmi script

Line that errors is "set objWMIService ..."

Error message is "0x8004100E"

RecycleAppPools("myComputerName")

Sub RecycleAppPools(strComputer)

set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}//" _
          &  strComputer & "/root/MicrosoftIISv2")

Set colItems = objWMIService.ExecQuery _ 
    ("Select * From IIsApplicationPool ")

For Each objItem in colItems 
    objItem.Recycle 
Next 

End Sub
wmi
asked on Stack Overflow May 22, 2015 by Tim • edited May 22, 2015 by Tim

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0