如何使用Powershell删除IIS自定义标头? [英] How do I remove IIS custom header using Powershell?
本文介绍了如何使用Powershell删除IIS自定义标头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在编写一个将网站部署到IIS 7的PowerShell脚本。我想使用PowerShell中的Web管理模块而不是appcmd执行以下命令来删除自定义标头。如何在powershell中使用appcmd执行此命令?
I am writing a powershell script that deploys a website to IIS 7. I would like to do the following command to remove a custom header using the Web-Administration module in powershell rather than with appcmd. How do I do this command in powershell not using appcmd?
appcmd set config /section:httpProtocol /-customHeaders.[name='X-Powered-By']
推荐答案
删除iis级别的标题:
To remove the header on iis level:
Remove-WebConfigurationProperty -PSPath MACHINE/WEBROOT/APPHOST
-Filter system.webServer/httpProtocol/customHeaders
-Name .
-AtElement @{name='X-Powered-By'}
特定网站:
Remove-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST/Default Web Site'
-Filter system.webServer/httpProtocol/customHeaders
-Name .
-AtElement @{name='X-Powered-By'}
这篇关于如何使用Powershell删除IIS自定义标头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文