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

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -