Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to recycle an app pool on a remote machine using the command line

I have the following in a vbs file that i am trying to run from the command line:

strServerName = "ServerName"
strAppPoolName = "DefaultAppPool"
set objAppPools = GetObject("IIS://" & strServerName 
                                  & "/w3svc/AppPools/" & strAppPoolName & "")
objAppPools.Recycle()

And yet when I run the vbs from cmd line i get the following error:

Microsoft VBScript runtime error: ActiveX component can't create object: 'Get Object'_

I am running XP on my local machine, and the remote machine has IIS 7.

How can I get this to work?

like image 897
Will I Am Avatar asked Mar 23 '11 13:03

Will I Am


1 Answers

I am not sure regarding the particular vb script but I would recommend using "appcmd" (http://learn.iis.net/page.aspx/114/getting-started-with-appcmdexe)

  1. Add %windir%\system32\inetsrv to your path if it is not already
  2. in a command prompt type: appcmd recycle apppool "apppool_name"
like image 125
Dan Avatar answered Oct 12 '22 22:10

Dan