How to export your Windows IIS website list to a txt and xls (Excel) file Print

  • Microsoft Windows, Windows Servers
  • 88

If you manage multiple websites on a Windows IIS server, exporting a list of your sites is useful for auditing, documentation, migration planning, or simply keeping a record. This guide covers two methods: a quick Command Prompt command and a more powerful PowerShell approach that gives you full control over the output format.

Method 1: Command Prompt (quick export)

Remote Desktop (RDP) into your server, open Command Prompt as Administrator, and run:

%windir%\system32\inetsrv\appcmd list site > C:\sites.txt

This creates a text file at C:\sites.txt listing all sites in IIS along with their bindings and state. You can open it in Notepad or import it into Excel by opening Excel and using File → Open to open the .txt file.

Note: The output is a plain text file, not a native Excel format. To get a properly structured spreadsheet, use the PowerShell method below.

Method 2: PowerShell (recommended, proper CSV output)

PowerShell gives you a structured, sortable spreadsheet with full control over which properties to include.

Export a basic site list to CSV

Import-Module WebAdministration
Get-Website | Select-Object Name, State, PhysicalPath, Id |
  Export-Csv -Path C:\iis-sites.csv -NoTypeInformation

This creates a proper CSV file at C:\iis-sites.csv which opens cleanly in Excel with each property in its own column.

Export a full site list including bindings and application pools

Import-Module WebAdministration
Get-Website | Select-Object Name, State, Id, PhysicalPath,
  @{N="ApplicationPool"; E={$_.applicationPool}},
  @{N="Bindings"; E={($_.bindings.collection | ForEach-Object {"$($_.protocol)://$($_.bindingInformation)"}) -join "; "}} |
  Export-Csv -Path C:\iis-sites-full.csv -NoTypeInformation

This exports each site with its name, state, ID, physical path, application pool, and all bindings (including HTTP and HTTPS) in a single row per site.

View the site list directly in the PowerShell console

Import-Module WebAdministration
Get-Website | Format-Table Name, State, PhysicalPath -AutoSize

Filter by state (running sites only)

Import-Module WebAdministration
Get-Website | Where-Object {$_.State -eq "Started"} |
  Select-Object Name, PhysicalPath |
  Export-Csv -Path C:\running-sites.csv -NoTypeInformation

Opening the CSV in Excel

  1. Open Excel and go to File → Open.
  2. Navigate to C:\iis-sites.csv and open it.
  3. If prompted by the Text Import Wizard, select Delimited, choose Comma as the delimiter, and click Finish.
  4. The data will open with each property in a separate column, ready to sort, filter, or format.

Troubleshooting

"The term 'Get-Website' is not recognized"

Run Import-Module WebAdministration first, or install the IIS management tools via Server Manager: Add Roles and Features → Web Server (IIS) → Management Tools → IIS Management Scripts and Tools.

The CSV opens as a single column in Excel

Select the column, go to Data → Text to Columns, choose Delimited → Comma, and click Finish.


Was this answer helpful?

« Back