简体   繁体   English

将主机头名称应用于IIS中站点的现有绑定的powershell脚本

[英]powershell script to apply host header name to an existing binding of a site in IIS

I want to apply host header name to an existing binding of a site in IIS. 我想将主机头名称应用于IIS中站点的现有绑定。 So far i got this command but it creates a new binding but i want to apply the hostheader to the existing one. 到目前为止,我收到了此命令,但是它创建了一个新的绑定,但是我想将hostheader应用于现有的。 Below is the command: 下面是命令:

new-webbinding -hostheader hostheadername -name sitename -protocol http

Is there any command to do this? 有命令执行此操作吗?

any help would be highly appreciated. 任何帮助将不胜感激。

You can easily construct this yourself using Set-WebBinding . 您可以使用Set-WebBinding轻松地自己构造它。

Example: 例:

Import-Module WebAdministration;
Set-WebBinding -Name "www.example.com" -HostHeader "original.example.com" -PropertyName "HostHeader" -Value "new.example.com"

您是否尝试过使用set命令

set -webbinding -hostheader hostheadername -name sitename

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM