2021年6月

新增规则:
netsh advfirewall firewall add rule name= "TCP80" dir=in action=allow protocol=TCP localport=80

删除规则:
netsh advfirewall firewall delete rule name= "TCP80"

https://cloud.tencent.com/developer/article/1462776

1.Powershell对app pool管理
1.1 查看:
Get-ChildItem –Path IIS:\AppPools

1.2 新建:
New-Item –Path IIS:\AppPools\MyAppPool

1.3 停止:
Stop-WebAppPool -Name MyAppPool

1.4 运行:
Start-WebAppPool -Name MyAppPool

1.5 重启:
ReStart-WebAppPool -Name MyAppPool

1.6 编辑属性:
Get-ItemProperty –Path IIS:\AppPools\MyAppPool | select *
Set-ItemProperty -Path IIS:\AppPools\MyAppPool -Name managedRuntimeVersion -Value v4.0

2.Powershell对web sites管理

2.1 查看
Get-Website

2.2 新建:

New-Website –Name MyWebApp –PhysicalPath D:\apidd
2.3 停止:

Stop-Website –Name MyWebApp
2.4 运行:

Start-Website –Name MyWebApp
2.5 重启:

Stop-Website –Name MyWebApp
Start-Website –Name MyWebApp

2.6 绑定:
Get-Website -Name MyWebApp
Get-WebBinding -Name MyWebApp
(Get-Website -Name MyWebApp).bindings.Collection
Set-WebBinding -Name 'MyWebApp' -BindingInformation "*:80:" -PropertyName Port -Value 81
New-WebBinding -Name MyWebApp -Protocol http -Port 82
//SSL bindings ??不确定
get-childItem IIS:SslBindings
$cert = Get-ChildItem cert:\localmachine\my
$bindingInfo = "IIS:\SSLBindings*!445"
$cert | Set-Item -Path $bindingInfo

2.9 移除:
Remove-WebSite -Name MyWebApp2