Skip to main content

Use the WebAdministration module's Get-WebFilePath cmdlet to get an IIS site, application, or virtual directory physical path.

Import-Module WebAdministration

# -----------------------------------------------------------------------------
# Get-WebFilePath
# Gets the physical path to the location of the specified IIS module.
# -----------------------------------------------------------------------------

# Get-WebFilePath returns a System.IO.DirectoryInfo object (

# Get the physical path of the default website
PS > (Get-WebFilePath -PSPath "IIS:\Sites\Default Web Site").FullName

# Get the physical path of an application with a website
PS > (Get-WebFilePath -PSPath "IIS:\Sites\Default Web Site\MyApp").FullName

# Get the physical path of a virtual directory within a website
PS > (Get-WebFilePath -PSPath "IIS:\Sites\Default Web Site\virtual-directory").FullName