PowerShell: Add MIME Type to IIS Static Content Collection

Here’s a PowerShell snippet that will add a custom header to the response from a designated website using the Add-WebConfigurationProperty cmdlet:

Import-Module WebAdministration
 
Add-WebConfigurationProperty //staticContent -name collection -value @{fileExtension='.woff2'; mimeType='application/x-font-woff'}

The Add-WebConfigurationProperty cmdlet is part of the IIS WebAdministration module.

Hope this helps!

This entry was posted in PowerShell. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *