Featured image of post View All IIS Website Information via Command Line

View All IIS Website Information via Command Line

Use the following command in Command Prompt (CMD) to check which websites are bound to IIS (Internet Information Services)…

You can use the following command in Command Prompt (CMD) to view the websites bound to IIS (Internet Information Services):

1
%windir%\system32\inetsrv\appcmd.exe list site

This command will list all the websites in IIS along with relevant information, including the website ID, name, physical path, and the bound protocols and ports.

After executing the command, you will see output similar to the following:

1
2
SITE "Default Web Site" (id:1,bindings:HTTP/*:80:,state:Started) 
SITE "My Website" (id:2,bindings:HTTP/*:8080:,state:Started)

Each website has a unique ID and name. The bindings column displays the protocol, IP address/hostname, and port associated with each website.

In addition to these common commands, appcmd offers many other commands for managing IIS. For example, you can use appcmd to create, delete, start, stop, or restart websites, as well as bind or unbind them.

Here are some specific examples:

  • Creating a website:
1
appcmd create site /name:<Website Name> /physicalPath:<Physical Path> /bindings:<Binding Info>

For example, to create a website named “www.example.com” with a physical path of “C:\inetpub\wwwroot\www.example.com” and bind it to “*:80”, you would use the following command:

1
appcmd create site /name:www.example.com /physicalPath:C:\\inetpub\\wwwroot\\www.example.com /bindings:*:80
  • Deleting a website:
1
appcmd delete site /name:<Website Name>

For example, to delete the website named “www.example.com”, you would use:

1
appcmd delete site /name:www.example.com
  • Starting a website:
1
appcmd start site /name:<Website Name>

For example, to start the website named “www.example.com”, you would use:

1
appcmd start site /name:www.example.com
  • Stopping a website:
1
appcmd stop site /name:<Website Name>

For example, to stop the website named “www.example.com”, you would use:

1
appcmd stop site /name:www.example.com
  • Restarting a website:
1
appcmd restart site /name:<Website Name>

For example, to restart the website named “www.example.com”, you would use:

1
appcmd restart site /name:www.example.com
  • Binding a website:
1
appcmd add site binding /sitename:<Website Name> /protocol:<Protocol> /bindingInformation:<Binding Info>

For instance, to bind the “https” protocol to the website named “www.example.com” with binding information of “*:443”, you would use:

1
appcmd add site binding /sitename:www.example.com /protocol:https /bindingInformation:*:443
  • Unbinding a website:
1
appcmd delete site binding /sitename:<Website Name> /protocol:<Protocol> /bindingInformation:<Binding Info>

For example, to remove the “https” binding for the website named “www.example.com” with binding information of “*:443”, you would use:

1
appcmd delete site binding /sitename:www.example.com /protocol:https /bindingInformation:*:443

For more commands related to appcmd, you can refer to the official IIS documentation.

Licensed under CC BY-NC-SA 4.0