Skip to content

Instantly share code, notes, and snippets.

@alexsandro-xpt
Forked from jcefoli/iischeatsheet.bat
Created March 3, 2017 18:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alexsandro-xpt/1c123a36716785d1fd0782b140502a17 to your computer and use it in GitHub Desktop.
Save alexsandro-xpt/1c123a36716785d1fd0782b140502a17 to your computer and use it in GitHub Desktop.
IIS Websites and Apppools Delete/Import/Export Cheat Sheet
REM Delete all Websites
%windir%\system32\inetsrv\appcmd list site /xml | %windir%\system32\inetsrv\appcmd delete site /in
REM Delete all App Pools
%windir%\system32\inetsrv\appcmd list apppool /xml | %windir%\system32\inetsrv\appcmd delete apppool /in
REM Export all the Application Pools:
%windir%\system32\inetsrv\appcmd list apppool /config /xml > C:\apppools.xml
REM Import all the Application Pools:
%windir%\system32\inetsrv\appcmd add apppool /in < C:\apppools.xml
REM Export all Websites:
%windir%\system32\inetsrv\appcmd list site /config /xml > C:\sites.xml
REM Import all Websites:
%windir%\system32\inetsrv\appcmd add site /in < C:\sites.xml
REM Recycle Individual App Pool
%windir%\system32\inetsrv\appcmd.exe recycle apppool /apppool.name:DefaultAppPool
REM When importing web sites on another host, note the IP bindings will be incorrect and may need to be adjusted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment