使用powershell添加绑定到IIS站点
我试图控制绑定在一个IIS应用程序使用PowerShell。 我想用脚本创build一个包含http和https绑定的站点。 这是我迄今为止: Param( [Parameter(Mandatory=$True,Position=1)] [string]$hostname, [Parameter(Mandatory=$True,Position=2)] [string]$installPath, [Parameter(Mandatory=$False,Position=3)] [string]$ip ) Import-Module WebAdministration $appPoolName = $hostname + 'Pool' $port = 80 $hostRecord = $hostname+'.example.com' $bindings = @{protocol="http";bindingInformation=$ip + ":"+ $port + ":" + $hostRecord} New-Item IIS:\AppPools\$appPoolName Set-ItemProperty IIS:\AppPools\$appPoolName managedRuntimeVersion v4.0 New-Item IIS:\Sites\$hostname -Bindings $bindings -PhysicalPath $installPath Set-ItemProperty IIS:\Sites\$hostname -Name applicationPool -Value $appPoolName 如何添加绑定到我的$bindingsvariables/使用其他机制来实现我的目标?