How to stop all running IIS sites from the command line using appcmd with pipe (single line)


c:\windows\system32\inetsrv\appcmd.exe list site /xml /state:"$=started" | appcmd stop site /in  

results in:

"Default Web Site" successfully stopped          
"myothersite" successfully stopped              

stopping all running websites on an IIS7 server.


Comments (2)

  1. Anonymous says:

    Thanks

  2. Kevin says:

    Only works if you're running from C:Windowssystem32inetsrv
    To have it work from anywhere:
    c:windowssystem32inetsrvappcmd.exe list site /xml /state:"$=started" | c:windowssystem32inetsrvappcmd.exe stop site /in

    ——

    yep. thx.

    regards,

    Bernhard

Skip to main content