Search code examples
powershelliisarr

Are IIS Application Request Routing Cache Control rules scriptable?


I have some cache control rules setup on ARR extension for IIS, I want to automate their creation for a new installation. Is there a way to do so on powershell or cmd? (running on Windows Server 2016 and IIS 10) Bonus point if the solution involve chef infra.


Solution

  • When the cache control rule is manually created in iis through the iis manager, you will find that there is a corresponding rule generated in the url rewrite module. enter image description here

    And in applicationHost file, you can see this enter image description here So if you want to use powershell to create cache control rule, just create a rule with similar content in url rewrite.

    The specific powershell statements can be viewed through the iis manager (appcmd or other script statements are also possible), you can create an instance rule according to your needs, obtain the powershell statements, and then change the parameters to form a complete powershell. You can check how to generate it from here. enter image description here