I am trying to create a Web application/VirtualDirectory under a specific subfolder of a IIS 6 website using Powershell as show below:
An alternative solution to create a virtual directory in IIS 6.0 through scripting, which doesn't involve PowerShell, is to use the iisvdir.vbs script:
SET webSiteName=Test
SET virtualDirName=subdirectory/gadgets
SET virtualDirHomePath=C:\InetPub\Subdirectory\Gadgets
cscript %SystemRoot%\system32\iisvdir.vbs /create %webSiteName% %virtualDirName% %virtualDirHomePath%
Note that the virtual directory path in virtualDirName
is specified using forward slashes.
You can also list the virtual directories in a specific path using the same iisvdir.vbs script:
cscript %SystemRoot%\system32\iisvdir.vbs /query %webSiteName%/%virtualDirName%