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

Related searches

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?


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"

How to recycle an app pool on a remote machine using the , 8 Answers. Add %windir%\system32\inetsrv to your path if it is not already. in a command prompt type: appcmd recycle apppool "apppool_name" Is it possible to recycle an IIS7 app pool from the command line, on a different machine? I've found APPCMD (appcmd recycle apppool my-app-pool), but it only operates on the host it's run on, AFAICT. I heard a rumor there might be a way to do it with Powershell, but I know nothing about that, and I'm apparently not very good at googling for it.


While not a vbs file command you could get vbs to execute this command line;

appcmd recycle apppool /apppool.name:string

The variable string is the name of the application pool that you want to recycle. For example, to recycle an application pool named Marketing, type the following at the command prompt, and then press ENTER:

appcmd recycle apppool /apppool.name:Marketing

Taken from technet

If it's too far away from what you want then my apologies.

Recycle remote IIS app pool from the command line?, Ken, if this is run from CMD you could do it with PSExec. This requires no installation on the server you want to access. Simply copy the� 1. Use appcmd.exe to recycle the application pool from the command prompt.


Use powershell command to run it. Example:

Invoke-WMIMethod Recycle -Path "IIsApplicationPool.Name='W3SVC/APPPOOLS/apppoolname'" -Computer "WIN-Computername" -Namespace root\MicrosoftIISv2 -Authentication PacketPrivacy

Where apppoolname is your application pool name.

Where WIN-Computername is your remote/local server name

Recycle remote IIS app pool from the command line? – Fixya Cloud, While not a vbs file command you could get vbs to execute this command line; appcmd recycle apppool /apppool.name:string The variable string is the name of � Today we will go through process for creating PowerShell function which will recycle Web App Pool remotely. For those who are working with Web Applications this might be helpful. To recycle/restart single Web App Pool we can use one of the commands available in WebAdministration module – Restart-WebAppPool :


Use powershell to execute command remotely on the server:

Invoke-Command -ComputerName <YOUR_IIS_SERVER_NAME> -ScriptBlock { Restart-WebAppPool -Name <YOUR_APP_POOL_NAME> }

Recycles an IIS app pool on a remote server � GitHub, Scenario / Questions Is it possible to recycle an IIS7 app pool from the command line, on a different machine? I've found APPCMD (appcmd� It means, if your application pool has crashed 5 times in 5 minutes, the application pool will be disabled]. If you have a load balanced server, there can be a scenario where one of the application pool has crashed and hence the load balancer has started redirecting traffic to the other ones.


I just tried it from a Windows XP machine to Windows 2008R2 machine. It worked. So you are definitely on the right track.

If you are looking for an alternative way, try this from a command prompt. At least the error message will be a little more specific, when it doesn't work.

wmic /namespace:"\\root\MicrosoftIISv2" /node:"**serverName**" path IISApplicationPool where (name like '%**DefaultAppPool**%') call recycle

recycle.ps1. # Author: Chris Kentfield. # Recycles an IIS app pool on a remote server. if($args.count -ne 2) {. echo "Syntax: recycle <machine> <app pool>". exit 1. }. Causes the specified application pool to be recycled. Examples----- EXAMPLE 1: Recycling an Application Pool -----IIS:\>Restart-WebAppPool DefaultAppPool. Recycles the application pool named DefaultAppPool. Parameters


or use the stop command. You could save this in a batch file, but it must be executed with higher privileges. For the application pool on a remote server, you could use PsExec: Psexec \\{Computer Name of ISS7 Server} C:\Windows\System32\inetsrv\appcmd recycle apppool my-app-pool


Recycle all apps pools in IIS by command line. Ask Question This is a remote server, your answer does not include remoteness of the server. – pbies Feb 27 at 16:16.


I can remotely get gwmi to work and recycle or start my app pools but ideally I only want to have to run this if the app pool is actually stopped. Would I need to work this out with PSExec or is there an alternative I can use similar to gwmi and have a one line command to call the app pool on the IIS7 server and give me the status?