Skip to content

Instantly share code, notes, and snippets.

@jcefoli
Last active January 20, 2023 18:25
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save jcefoli/608b4356a547d51b62f7 to your computer and use it in GitHub Desktop.
Save jcefoli/608b4356a547d51b62f7 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
@Tantino
Copy link

Tantino commented Aug 12, 2019

Update only property in pool
appcmd.exe set AppPool -processModel.identityType:SpecificUser /in < C:\apppools.xml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment