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 (http://technet.microsoft.com/en-us/library/bb878047.aspx):
"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:
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:
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:
Target server Name (strServer)
Target server Username (strUsername)
Target server User Password (strPassword)
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: