Skip to content

Instantly share code, notes, and snippets.

@sonuame
Last active November 5, 2023 17:45
Show Gist options
  • Save sonuame/0bbb8a7d59075c4f557fb57a86da4489 to your computer and use it in GitHub Desktop.
Save sonuame/0bbb8a7d59075c4f557fb57a86da4489 to your computer and use it in GitHub Desktop.
powershell-automations
setlocal
cd /d %~dp0
set backupdir=D:\iis\
%windir%\system32\inetsrv\appcmd list apppool /config /xml > %backupdir%\apppools.xml
%windir%\system32\inetsrv\appcmd list site /config /xml > %backupdir%\sites.xml
rem RESTORE
%windir%\system32\inetsrv\appcmd add apppool /in < apppools.xml
%windir%\system32\inetsrv\appcmd add site /in < sites.xml
pause
setlocal
cd /d %~dp0
cd %systemroot%\system32\inetsrv
appcmd list site /xml | appcmd delete site /in
appcmd list apppools /xml | appcmd delete apppool /in
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment