Welcome to ciysys blog

Get all website entries in IIS

Published on: 6th Feb 2020

Updated on: 16th Jan 2022

Explanation

It's very easy to get the list of the website entries in IIS with 3 lines of code.

Import-Module WebAdministration
cd IIS:\Sites
Get-ChildItem | select name

Explanation:

  1. We need to import the WebAdministration PS module. This module includes all the necessary API for Powershell to interact with IIS.

  2. The second line is to change the current location to the IIS Sites folder.

  3. Finally, get all the items in the current location and show the name attribute of the object.

Notes

Jump to #POWERSHELL blog

Author

Lau Hon Wan, software developer.