Monday, February 04, 2008

Recycling the App Pool Remotely

When you are running SharePoint in the enterprise, inevitably you are going to need to recycle the SharePoint app pool. This is a valuable article from Microsoft TechNet I found so i did not have to log into the server to recycle it.

Taken from TechNet (

"This is a very good question and one that Microsoft gets asked frequently by customers. The short answer is, yes, this can be done remotely. The long answer though requires a little knowledge of scripting if you are running IIS 6.0 on a Windows Server 2003 RTM version.

The script you need to do this locally is in Windows Server 2003 Service Pack 1, available from the Microsoft Download Center.

The command-line syntax used locally is:

iisapp /p /r

For example, if the w3wp process was Process ID (PID) 1234, then the command issued is:

iisapp.vbs /p 1234 /r

You can also use the Application Pool's friendly name instead of the PID by using the /a switch instead of the /p.

You can view all the switches and options using the command-line help for iisapp.vbs by typing the command:

iisapp.vbs /?

However, the iisapp.vbs command-line utility does not support remotely connecting to a computer.

If you are familiar with developing scripts this problem is solved using Windows Management Instrumentation (WMI) scripting or Active Directory Services Instrumentation (ADSI). These technologies are well documented in MSDN and you can use the IIS provider to connect to and recycle the application pools.

For example, here is a simple sample script with no error checking or dialog boxes. It also accepts no switches. However, it enables you to remotely recycle an application pool when you supply the following pieces of information in the script:

  1. Target server Name (strServer)

  2. Target server Username (strUsername)

  3. Target server User Password (strPassword)

  4. Application Pool name

I hope this sample script gets you started on your way to recycling a worker process running on a remote IIS 6.0 server:

strServer = "MyServer" //Replace this with the target server name strUser = "Administrator" //Provide Administrator privilege credentials strPassword = "password" //Input Administrator privileged account password Set LocatorObj = CreateObject("WBemScripting.SWbemLocator") LocatorObj.Security_.ImpersonationLevel = 3 Impersonate LocatorObj.Security_.AuthenticationLevel = 6 Pkt Privacy (required for remote administration over WMI as of Win2k3 SP1) Set ProviderObj = LocatorObj.ConnectServer(strServer, "root/MicrosoftIISv2", strUser, strPassword) Set MyAppPool = ProviderObj.Get( "IIsApplicationPool=w3svc/apppools/DefaultAppPool" MyAppPool.Recycle

There is detailed information in the IIS SDK to help you write a script that can remotely connect to an IIS server at:

By the way, the iisapp.vbs file that is delivered with Windows Server 2003 Service Pack 1 (SP1) can easily be copied to a Windows Server 2003 RTM version. There was no change in functionality to the core server between RTM and Service Pack 1 that would cause this script to not work. However, the script does not work on IIS versions below 6.0.

To review the changes added to Service Pack 1 for IIS 6.0, please review the following document on Microsoft's Web site:"

1 comment:

  1. miley cyrus nude [url=]miley cyrus nude[/url] miley cyrus nude [url=]miley cyrus nude[/url]