Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Can I use adsutil.vbs to remove the X—Powered-By response header from IIS6 configuration?

We have a site that is running on some IIS6 servers. Migration to IIS7 is a few months away at least. In the mean time, I have noticed that it is serving the header X—Powered-By: ASP.NET on all responses. I want this gone since it is a waste of bytes and a minor security risk. I strongly prefer to script this so that future deployments also ensure that the header is not present.

We have one or two custom headers that I want to keep, but those should be added by the deployment script so clearing them all upfront may be an option.

Is there a way to do this using adsutil.vbs?

share|improve this question

1 Answer 1

To get the current custom headers:

cscript adsutil.vbs GET W3SVC\HttpCustomHeaders

and to clear them all:

cscript adsutil.vbs SET W3SVC\HttpCustomHeaders ""

You can obviously do this at a site level by inserting the site ID: W3SVC\123\HttpCustomHeaders

share|improve this answer
    
I definitely don't want to clear them all - just the "X—Powered-By" one. The automation would also have to determine the right site id. –  Anthony Oct 16 '12 at 16:30
    
Do you use any other custom ones? If so you can just use the SET command, re-adding in all the custom headers but exclude the Powered-by one. As for the site ID, as long as the sites are all named the same way (and were named that way when they were created), the IDs should be the same. IIS6 generated the ID based on the site name when creating the site. Check first though! –  Chris McKeown Oct 16 '12 at 23:23
    
I have expanded on this in the question. it may be an option. Thanks. –  Anthony Oct 17 '12 at 10:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.