Use this when mapping a URL path to a different folder in IIS.
Virtual Directories
A virtual directory maps a URL path in an IIS site to a physical folder elsewhere, such as /files to D:\Shared, without making it a separate application.
1. Get-WebVirtualDirectory -Site <site>.
2. Physical path reachable (UNC credentials).
3. Pool identity permissions.
4. Not an application (inherits).
5. Test URL.
URL path → virtual directory → physical folder
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Common mistakes Narrow the fault
- Pointing to UNC paths without configuring credentials.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- A virtual directory is not a separate application.
- The pool identity needs access to the physical path.
- It inherits the site's settings.
Get-Website— sites, state, bindingsGet-IISAppPool— application pools and stateGet-WebBinding— bindingsGet-ChildItem IIS:\SslBindings— certificate bindingsGet-Content C:\inetpub\logs\LogFiles\W3SVC<id>\*.log -Tail 20— request log
ReferenceWhy it matters1 section · depth on demand
What it is
A virtual directory maps a URL path in a site (/docs) to a physical folder that can be outside the site root. It runs inside the parent application. An application is similar but has its own app pool and configuration boundary.
ReferenceHow it works1 section · depth on demand
In depth
Virtual directories map a URL path to a physical folder (possibly on another drive or UNC share) without being a separate application.
New-WebVirtualDirectory -Site intranet -Name docs -PhysicalPath \\fs01\webdocs
Set-WebConfigurationProperty -PSPath IIS:\Sites\intranet\docs -Filter system.applicationHost/sites/site/application/virtualDirectory -Name userName -Value 'CORP\svc-webcontent'
Applications (New-WebApplication) differ: they get their own app pool and web.config scope. UNC-backed content needs credentials (connect-as or app pool identity with share permissions) and is sensitive to file server latency.
ReferenceImportant terms & boundaries1 section · depth on demand
Commands
New-WebVirtualDirectory -Site 'Default Web Site' -Name docs -PhysicalPath D:\Docs
Get-WebVirtualDirectory
Documented example, not captured output.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in IIS → Virtual Directories. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://learn.microsoft.com/en-us/iis/ · confidence 94%Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.