2013-07-11 11 views
5

Chcę zainstalować funkcję ograniczenia adresów IP i domeny w moim wdrożeniu platformy Azure, ale używam wersji 3 systemu (serwer 2012), która dokonała deprecjacji usługi ServerManageCmd, dlatego następujący kod nie działa:Instalowanie funkcji zadania uruchamiania systemu Azure dla systemu Windows Server 2012

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 

ServiceDefinition.csdef częściowy

<Startup> 
     <Task commandLine="Startup\StartupTasks.cmd" executionContext="elevated" taskType="simple" /> 
</Startup> 

Sądzę, że potrzebuję użyć poleceń programu Power Shell, ale jestem tu trochę nie na miejscu. Czy ktoś może dostarczyć 2012 odpowiednik tego kodu?

Odpowiedz

10

Dla osób grających w domu, oto odpowiedź!

@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 
Powiązane problemy