Bernhard Frank's Blog

heiter und wolkig - zu den Themen Windows Server 2012, PowerShell, Private Cloud und Web (IIS)

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

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

  • Comments 2
  • Likes

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
  • Thanks

  • Only works if you're running from C:\Windows\system32\inetsrv
    To have it work from anywhere:
    c:\windows\system32\inetsrv\appcmd.exe list site /xml /state:"$=started" | c:\windows\system32\inetsrv\appcmd.exe stop site /in

    ------

    yep. thx.

    regards,

    Bernhard

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment