On some servers we have many old Virtual Directories created for previous versions of our application.
IIS user interface allows to delete only one in a time.
Fortunately we can use IIS scripts as described in
I’ve created batch file DeleteOldVDirs.cmd
rem syntax: iisvdir /delete WebSite [/Virtual Path]Name [/s Computer [/u [Domain]User /p Password]]
REM list all directories and create batch of deletes
iisvdir /query “Default Web Site”
echo “Enter Ctrl-C if you want to stop deleting”
iisvdir /delete “Default Web Site/VDirName1”
iisvdir /delete “Default Web Site/VDirName2”
If the name of WebSite or Virtual directory contain spaces(e.g “Default Web Site”), don’t forget to use double quotes.
Note that the batch doesn’t delete physical directories from flie system.You need to delete them using Windows Explorer, but it does support multiple selection!