Thursday, August 11, 2011

Adding a mime type to IIS vis powershell

You must have the WebAdministration snappin or module loaded (this should come as part of the IIS install) then simply:

add-webconfigurationproperty //staticContent -name collection -value @{fileExtension='.otf'; mimeType='application/octet-stream'}

1 comment:

  1. Thanks for this. One thing to look out for is that the working directory hasn't been changed to a sub-directory of IIS:\
    I tried to run this command after previous scripts had done a "cd IIS:\appPools" and it did not work. cd IIS:\ fixed it.

    ReplyDelete