I’m new here, so apologies if this is an obvious answer. I have tried to find a cmdlet that would achieve this edit, but I’m not having much luck. I would like to add the requestFiltering section at SITE level [ie: web.config].
Only examples I’ve found online would only achieve this at server-level via an appcmd command. So I’ve resorted to trying to write a script to edit the web.config directly, to inject the section into the section.
Is there anything obvious I can use, or can someone please suggest some quick code please?
A web config file is just a XML file. There are many articles on opening an XML file and adding a node, editing a property or element utilizing Powershell. Without seeing an example, it’s going to be difficult to help you. This site will eat html\XML, so you will need to use github if you do want to post an example of your XML and desired result.
@Rob: Thanks for the links, I shall check those out - looks promising.
@Arie: I started off looking at these, but from what I can gather, they only allow you to set these settings at server-level in IIS and not at site-level as required in this instance.
Reading through the documentation notes it appears that those commands check against a schema which would prevent you from setting incorrect web.config items. Thanks for the reference, another feather in the cap.