Temporarily redirect *all* HTTP/HTTPS requests in IIS to a "server maintenance" page

I would go with your third approach "We're offline" Site in IIS, say you named it Offline, if it has no host header specified it will serve all requests not picked up by any of the other sites which have a matching host header. To prevent this you just stop all other sites.

Assuming you have IIS Scripting installed, open an elevated PowerShell:

import-module webadministration

now you can stop all sites except the Offline one:

Get-ChildItem IIS:\Sites | Where {$_.Name -ne "Offline"} | Stop-WebSite

when the SQL-Server is back up, start them up again:

Get-ChildItem IIS:\Sites | Where {$_.Name -ne "Offline"} | Start-WebSite

If you have FTP sites as well, the commands will show an error because you can not pipe an FTP site to a Stop-WebSite cmdlet, but it still works for all the web sites.

If you have sites that normally not run, you have to exclude them in the second command, like:

Where {$_.Name -ne "Offline" -and $_.Name -ne "foobar.com"}

If you don't have the PowerShell cmdlets for IIS installed, you can use appcmd.exe to do the same, I haven't used that in years though.


All our sites are setup in IIS with a single IP.

1) take an old desktop, run live linux distro, give it the same ip as the IIS box, do not connect it to network

2) fire up nginx on live linux box, and make the downtime page as you like it, test it by using an offline switch/hub connected to ur laptop

3) unplug IIS box ethernet cable, and plug it into live linux box.

4) clear mac addr cache on switch (or roll power). your downtime site is now live.