Disclaimer: I am a consultant at Amazon Web Services, and this is my personal blog. The opinions expressed here are solely mine and do not reflect the views of Amazon Web Services (AWS). Any statements made should not be considered official endorsements or statements by AWS.
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"
}