In some environments adding new virtual directories is a daily, if not hourly task. Automating this type of work is what we all prefer. Here’s some Powershell I’ve used recently to script IIS Virtual Directory setup. One thing about this script I like is it takes very little input, just the website name. The script pulls from existing settings to create the new virtual directory. If you had a single website, you wouldn’t even need this input.