Engineering scalable systems, cloud-native applications, and AI-powered solutions.

Get physical path of an IIS website using PowerShell

Below piece of code will give you physical path of an IIS website.

Ankush Jain

Ankush Jain

Lead Software Engineer (VP) | Software Architect

Published Aug 28, 2018Updated Nov 24, 2026

Below piece of code will give you physical path of an IIS website.

powershell
Import-Module WebAdministration
[string] $iisWebsiteName = 'Default Web Site'
$iisWebsite = Get-WebFilePath "IIS:\Sites\$iisWebsiteName"
if($iisWebsite -ne $null)
{
Write-Output "Website's physical path:"
Write-Output $iisWebsite.FullName
}
else
{
Write-Output "Website not found"
}

See below image:

enter image description here

Have feedback or thoughts?

Discuss this article or share it on Twitter / GitHub.