Posts

Showing posts from February, 2020

View the binding for the website in IIS

To view the binding, you need to call Get-WebBinding API.   Import-Module WebAdministration    Get-WebBinding -Name 'default web site' Explanation: 1. We import the WebAdministration PS module into memory so that we can call any of the API that interacts with IIS. 2. Call Get-WebBinding to retrieve the binding for the "default web site" (you might have website that is different name). In case you need to find out all website names, please run the following codes:    Get-ChildItem IIS:\Sites | select name

Get all website entries in IIS

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 IIS Sites folder. 3. Finally, get all the items in the current location.