Powershell equivalent to this AppCmd command?


hi,

i trying equivalent of appcmd command in powershell:

c:\windows\system32\inetsrv\appcmd.exe set config "cfadmin" -section:system.webserver/security/requestfiltering /-"denyurlsequences.[sequence='/testing']"

basically @ top level in iis have denyurlsequences set websites url sequence "/testing" , want 1 website override setting , allow path in url.

anyone got ideas?

thanks

that should work too:

 

  [system.reflection.assembly]::loadwithpartialname("microsoft.web.administration") | out-null $servermanager = new-object microsoft.web.administration.servermanager $config = $servermanager.getwebconfiguration("test"); $requestfilteringsection = $config.getsection("system.webserver/security/requestfiltering"); $denyurlsequencescollection = $requestfilteringsection.getcollection("denyurlsequences"); $addelement = $denyurlsequencescollection.createelement("add"); $addelement["sequence"] = "/testing"; $denyurlsequencescollection.add($addelement); $servermanager.commitchanges();   




Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

server manager error: ADAM.events.xml could not be enumerated.

Cannot access Anywhere Access using domain name?

WMI Failure: Unable to update Local Resource Group