Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
PS C:\Users\Administrator> Get-Website -Name "Default Web Site"
Name ID State Physical Path Bindings
---- -- ----- ------------- --------
Default Web Site 1 Started %SystemDrive%\inetpub\wwwroot http *:80:
# for example, set physical folder [C:\inetpub\wwwroot\virtual_dir], URL Path [/vDir] on [Default Web Site]
PS C:\Users\Administrator> mkdir C:\inetpub\wwwroot\virtual_dir
PS C:\Users\Administrator> New-WebVirtualDirectory -Site "Default Web Site" -Name "vDir" -PhysicalPath "C:\inetpub\wwwroot\virtual_dir"
Name PhysicalPath
---- ------------
vDir C:\inetpub\wwwroot\virtual_dir
PS C:\Users\Administrator> Get-WebVirtualDirectory -Site "Default Web Site"
Name Physical Path
---- -------------
vDir C:\inetpub\wwwroot\virtual_dir
# create a test page
PS C:\Users\Administrator> Write-Output "IIS Virtual Directory Test Page" | Out-File C:\inetpub\wwwroot\virtual_dir\index.html -Encoding Default
# verify accesses
PS C:\Users\Administrator> curl.exe localhost/vDir/
IIS Virtual Directory Test Page
|