Command Line cscript HTTP Headers IIS Linux Windows

Set IIS 6 (and IIS 7) custom HTTP headers from the command line

Command line method to set the Custom HTTP Headers.
*Must execute from (default) c:InetpubAdminScripts:

cscript adsutil.vbs set w3svc/HttpCustomHeaders “X-Powered-By: ASP.NET” “<Header 2>: <Value 2>” “<Header 3>: <Value 3>”

Just replace “Header 2”: “Value 2” and “Header 3”: “Value 3” with your own values. Add more as desired.

Note: This command updates/replaces current values and does not add to them so any existing value must be included or it will be overwritten. I included “X-Powered-By: ASP.NET” as it’s a common default HTTP header value.

This works on both IIS 6 and IIS 7, not sure about previous versions.