Back to all blogs3 min read
Get physical path of an IIS website using PowerShell
Below piece of code will give you physical path of an IIS website.
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.
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