Quantcast
Channel: Configuration & Scripting
Viewing all articles
Browse latest Browse all 780

How to configure Static\Dynamic types with powershell

$
0
0

Hello, I'm looking to convert this to powershell and\or powershell dsc.

appcmd set config /section:staticContent /+"[fileExtension='.less',mimeType='text/css']" /commit:apphost
appcmd.exe unlock config /section:system.webServer/serverRuntime

appcmd.exe set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='text/*',enabled='True']" /commit:apphost
appcmd.exe set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='message/*',enabled='True']" /commit:apphost
appcmd.exe set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='application/x-javascript',enabled='True']" /commit:apphost
appcmd.exe set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='application/json',enabled='True']" /commit:apphost
appcmd.exe set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='application/json; charset=utf-8',enabled='True']" /commit:apphost
appcmd.exe set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='application/xml" enabled',enabled='True']" /commit:apphost
appcmd.exe set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='application/xml; charset=utf-8',enabled='True']" /commit:apphost
appcmd.exe set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='*/*',enabled='false']" /commit:apphost

appcmd.exe set config -section:system.webServer/httpCompression /+"staticTypes.[mimeType='text/*',enabled='True']" /commit:apphost
appcmd.exe set config -section:system.webServer/httpCompression /+"staticTypes.[mimeType='message/*',enabled='True']" /commit:apphost
appcmd.exe set config -section:system.webServer/httpCompression /+"staticTypes.[mimeType='application/x-javascript',enabled='True']" /commit:apphost
appcmd.exe set config -section:system.webServer/httpCompression /+"staticTypes.[mimeType='application/atom+xml',enabled='True']" /commit:apphost
appcmd.exe set config -section:system.webServer/httpCompression /+"staticTypes.[mimeType='application/xaml+xml',enabled='True']" /commit:apphost
appcmd.exe set config -section:system.webServer/httpCompression /+"staticTypes.[mimeType='*/*',enabled='false']" /commit:apphost

I figured I could get those with something like $properties = Get-WebConfigurationProperty -Filter "/system.webserver/httpcompression" -Name dynamicTypes. but I have no idea how to update them. the collection doesn't support adding members.

Thanks in advance!


Viewing all articles
Browse latest Browse all 780

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>