IISRestart command line utility
The iisrestart.exe command line utility replaces and expands Microsoft's iisreset utility. Besides iisrestart offers a lot more commands, it also e.g. executes http requests to the sites when a start command is given, effectively causing the site(s) to start and initialize.
This article gives an overview of the available commands and describes each of them in detail, including some examples. When a command includes the option of specifying a particular site (either optional or required), always specify the site's friendlyname (description column within the IIS Manager) and not the numeric identifier.
Startsite
Copy Code | |
---|---|
iisrestart /startsite <sitename> |
- Using Active Directory Service Interfaces (ADSI) the site object is retrieved and a start command is invoked on the object.
- The smartsite.config configuration file is read to determine the ServerAddress (the address of the publication engine) and the ManagerAddress (the address of the cms engine).
- Executes a http request to both addresses and displays the result of each request.
Sitename is required.
Stopsite
Copy Code | |
---|---|
iisrestart /stopsite <sitename> |
- Using ADSI the site object is retrieved and a stop command is invoked on the object.
- Again using ADSI, the application pool(s) in use by the specified site is/are determined.
- On the application pool(s) found, a recycle command is invoked.
Sitename is required.
Start
Copy Code | |
---|---|
iisrestart /start |
- Invoke a "iisreset /start" command as new process (an additional command window will be opened).
- Using ADSI the local IIS instance is searched for enabled Smartsite sites
(State <> "Stopped" and site-folder must contain smartsite.config file). - For each site found, the smartsite.config file is read to determine ServerAddress and ManagerAddress.
- Execute a http request to both of these addresses and display result.
Stop
Copy Code | |
---|---|
iisrestart /stop |
Status
Copy Code | |
---|---|
iisrestart /status iisrestart /status sites:emptysix,test6 |
- When no sites have been specified, ADSI is used to determine the local Smartsite sites
(site-folder must contain smartsite.config file). - When sites-parameter has been used, each specified site-name is checked for existence using ADSI.
- For each checked/found site, the smartsite.config is read to determine ServerAddress and ManagerAddress and then http requests to both addresses are executed and the result written to the console window.
Recycle
Copy Code | |
---|---|
iisrestart /recycle <name> iisrestart /recycle IIS://<machinename>/w3svc/AppPools/<name> |
- Using ADSI, the specified Application Pool object is retrieved.
- A recycle command is invoked on the object.
To recycle a local Application Pool, just specify its name. To recycle an Application Pool on a remote machine, you must specify the full Active Directory path.
Update
Copy Code | |
---|---|
iisrestart /update sites:<name1,name2> iisrestart /update sites:emptysix start:false stop:true iisrestart /update sites:<name> sourcedir:"D:\Development\New release" |
- If no sites have been specified, a list of local Smartsite sites is determined using ADSI.
- If one or multiple sites have been specified using the sites command line argument (comma-separated), this list is checked and each site which could not be found will be skipped.
- For each site a stopsite (see above) command is invoked (unless stop:false has been specified as command line argument).
- Copies the specified set of assemblies to the bin folder of the site. When no sourcedir has been specified, the SourceDirectory application setting (as configured within iisrestart.exe.config) will be used as source directory.
- A startsite (see above) command is invoked for the site (unless start:false has been specified).
Info
Copy Code | |
---|---|
iisrestart /info |
Sites
Copy Code | |
---|---|
iisrestart /sites |
IISInfo
Copy Code | |
---|---|
iisrestart /iisinfo iisrestart /iisinfo <name> |
Endpoints
Copy Code | |
---|---|
iisrestart /endpoints |
(The WMI provider for WCF must have been enabled within the web.config to be able to query the endpoints.)
Services
Copy Code | |
---|---|
iisrestart /services |
(The WMI provider for WCF must have been enabled within the web.config to be able to query the services.)
Queryadsi
Copy Code | |
---|---|
iisrestart /queryadsi <path> iisrestart /queryadsi 1668096977 iisrestart /queryadsi 1668096977/root/cms iisrestart /queryadsi AppPools/emptysix iisrestart /queryadsi IIS://<machinename>/w3svc/<path> |
Path is required, and when querying a site path must start with a valid numeric identifier, corresponding with an identifier as displayed within the Internet Information Services Manager. When the specified path does not start with IIS:// a local path is assumed and IIS://localhost/w3svc/ is prefixed automatically. You can use the objecttree command to get a list of valid identifiers.
Objecttree
Copy Code | |
---|---|
iisrestart /objecttree [<path>] iisrestart /objecttree AppPoos iisrestart /objecttree IIS://<machinename>/w3svc/AppPools |
Extendedhelp
Copy Code | |
---|---|
iisrestart /extendedhelp |