Ben*_*nC3 5 asp.net iis powershell azure windows-server-2012
我想在我的Azure部署中安装IP和域限制功能,但我使用的是os版本3(Server 2012),它已经弃用了ServerManageCmd,因此以下代码不起作用:
StartupTask.cmd
@echo off
@echo Installing "IPv4 Address and Domain Restrictions" feature
%windir%\System32\ServerManagerCmd.exe -install Web-IP-Security
@echo Unlocking configuration for "IPv4 Address and Domain Restrictions" feature
%windir%\system32\inetsrv\AppCmd.exe unlock config -section:system.webServer/security/ipSecurity
Run Code Online (Sandbox Code Playgroud)
ServiceDefinition.csdef partial
<Startup>
<Task commandLine="Startup\StartupTasks.cmd" executionContext="elevated" taskType="simple" />
</Startup>
Run Code Online (Sandbox Code Playgroud)
我相信我需要使用powershell命令,但我在这里有点不太深入.任何人都可以提供2012年此代码的等价物吗?
Ben*_*nC3 10
对于那些在家里玩的人来说,这就是答案!
@echo off
@echo Installing "IPv4 Address and Domain Restrictions" feature
powershell -ExecutionPolicy Unrestricted -command "Install-WindowsFeature Web-IP-Security"
@echo Unlocking configuration for "IPv4 Address and Domain Restrictions" feature
%windir%\system32\inetsrv\AppCmd.exe unlock config -section:system.webServer/security/ipSecurity
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
667 次 |
| 最近记录: |