asp.net - Installing feature in Azure startup task for Windows Server 2012 -


i want install ip , domain restrictions feature in azure deployment, i'm using os version 3 (server 2012) has depreciated servermanagecmd, following code not work:

startuptask.cmd

@echo off  @echo installing "ipv4 address , domain restrictions" feature  %windir%\system32\servermanagercmd.exe -install web-ip-security  @echo unlocking configuration "ipv4 address , domain restrictions" feature  %windir%\system32\inetsrv\appcmd.exe unlock config -section:system.webserver/security/ipsecurity 

servicedefinition.csdef partial

<startup>       <task commandline="startup\startuptasks.cmd" executioncontext="elevated" tasktype="simple" /> </startup> 

i believe need use powershell commands i'm little out of depth here. can provide 2012 equivalent of code?

for playing @ home, here's answer!

@echo off  @echo installing "ipv4 address , domain restrictions" feature  powershell -executionpolicy unrestricted -command "install-windowsfeature web-ip-security"  @echo unlocking configuration "ipv4 address , domain restrictions" feature  %windir%\system32\inetsrv\appcmd.exe unlock config -section:system.webserver/security/ipsecurity 

Comments

Popular posts from this blog

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -