Script to get website(s) information from IIS 6 on Windows 2003 servers

With Windows Server 2003 end of life coming up in July 14, 2015, many organizations are busy trying to migrate from Server 2003 to Server 2012 R2. This Powershell script/tool will get web site information for one or more web sites from a Windows 2003 Server running IIS 6.

This script is intended to be run from a Windows 8.1 or Server 2012 R2 machine. It has been tested on Server 2012 R2 (Powershell 4).  However, the scriptblocks that interact with Server 2003 have been tested on Powershell 2. The script will powershell-remote into the Windows 2003 server to retrieve the website(s) information. For more information on Powershell remoting to Server 2003 from Windows 8.1/Server 2012 R2 see this post.

To use this script, download it from the Microsoft Script Center Repository, unblock the file, and run it like:

.\Get-WebSite.ps1 -WebSite -ComputerName MyW2k3Server -AdminName administrator

The script saves the encrypted admin password for future use. If the file does not exist, the user is prompted for the password:


The script output is a PS Object containing:

  • WebSiteName: for example or
  • Bindings: each binding will have hostname, IP, and Port properties
    • if the host header name is bound to * All Unassigned *, the returned IP will be blank
  • Path: local path on web server where the web site resides
    • if the web site is redirected in IIS, this field will contain redirection URL
  • FileCount: number of files in the web site
  • FolderSize: total file size of the web site
  • vFolders: each VirtualFolder will have Path, vFolder, FileCount, FolderSize
    • This will be blank for redirected websites
  • AutoStart: True or False value to indicate whether or not the website is set to auto-start
  • ID: internal ID number used by IIS
  • LogFolder: local path to IIS logs for this web site
  • Server: name of the web server where this web site resides
  • SSL: secure binding (if any). It has IP and Port properties


The output object of this script contains Bindings, SSL, and vFolders properties which are objects having their own properties. The output will not export properly to CSV but can be saved to and retrieved from XML using the Import-Clixml and Export-Clixml cmdlets.

-XML and -CSV are optional parameters of XML and CSV file names. When used, the script will save website raw information in theses filesGet-WebSite003


.\Get-WebSite.ps1 -WebSite, -ComputerName MyW2k3Server -AdminName administrator -Verbose

Get-WebSite004This example returns information about the websites ‘’ and ‘’ on the server ‘MyW2k3Server’. The -Verbose parameter displays progress information.


$MyWebSites = .\Get-WebSite.ps1, MyW2k3Server administrator -Verbose
$MyWebSites | Out-GridView

This example displays the websites’ information in Powershell_ISE Grid View

    select WebSiteName,ID,Server,FileCount,@{N='Size(MB)';
        E={[Math]::Round($_.FolderSize/1MB,0)}} |
            FT -Auto

This example displays the websites’ information on the console screen

$MyWebSites| % {
    $_ | select WebSiteName,ID,Server,FileCount,@{N='Size(MB)';
        E={[Math]::Round($_.FolderSize/1MB,0)}} | FT -Auto 
    $_.Bindings | FT -Auto 
    $_.vFolders | FT -Auto 

This example displays the websites’ information on the console screen, including Bindings and vFolders


$MyWebSites = .\Get-WebSite.ps1 (Get-Content .\mywebsites.txt) MyW2k3Server administrator -Verbose
$MyWebSites | Out-GridView

This example retieves information about each of the websites listed in the .\mywebsites.txt file and displays it to Powershell_ISE Grid View


If the -WebSite parameter is not provided the script will retrieve web sites’ information about all websites on the provided server.

.\Get-WebSite.ps1 -ComputerName MyW2k3Server -AdminName administrator -Verbose

This example will retrieve information on all web sites on server ‘MyW2k3Server’


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.