Skip to content

Instantly share code, notes, and snippets.

@AvnerHadjadj
Forked from alexsandro-xpt/iischeatsheet.bat
Created October 28, 2025 14:36
Show Gist options
  • Select an option

  • Save AvnerHadjadj/789c12d059f90df19a369dd61f223922 to your computer and use it in GitHub Desktop.

Select an option

Save AvnerHadjadj/789c12d059f90df19a369dd61f223922 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