Skip to content

Instantly share code, notes, and snippets.

@joebuschmann
Created June 6, 2014 12:09
Show Gist options
  • Save joebuschmann/2b87280535cdcc1d9b41 to your computer and use it in GitHub Desktop.
Save joebuschmann/2b87280535cdcc1d9b41 to your computer and use it in GitHub Desktop.
A batch script that builds out a website, virtual directory, application, and app pool using AppCmd.exe
CD %systemroot%\system32\inetsrv
REM Add a new site and enable Windows authentication
MKDIR C:\Blogs
APPCMD add site /name:Blogs /bindings:"http/*:81:" /physicalPath:"C:\Blogs"
APPCMD set config "Blogs" -section:system.webServer/security/authentication/windowsAuthentication /enabled:"True" /commit:apphost
REM Create a virtual directory
MKDIR C:\Blogs\Technology
APPCMD add vdir /app.name:"Blogs/" /path:/Technology /physicalPath:C:\Blogs\Technology
REM Create an app pool qualified by the virtual directory name
APPCMD add apppool /name:Technology.JoeBuschmann
REM Configure the app pool
APPCMD set apppool "Technology.JoeBuschmann" /managedRuntimeVersion:v4.0 /processModel.pingingEnabled:false /processModel.identityType:NetworkService
REM Create the application
MKDIR C:\Blogs\Technology\JoeBuschmann
APPCMD add app /site.name:"Blogs" /path:/Technology/JoeBuschmann /physicalPath:C:\Blogs\Technology\JoeBuschmann
REM Configure the application
APPCMD set app "Blogs/Technology/JoeBuschmann" /applicationPool:Technology.JoeBuschmann
IISRESET
PAUSE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment