How to use POWERSHELL to set MimeTypes in an IIS6 website?

Posted by jacko on Stack Overflow See other posts from Stack Overflow or by jacko
Published on 2010-06-02T13:17:42Z Indexed on 2010/06/02 14:24 UTC
Read the original article Hit count: 412

Filed under:
|
|

I want to be able to replicate this adsutil.vbs behaviour in powershell:

cscript adsutil.vbs set W3SVC/$(ProjectWebSiteIdentifier)/MimeMap ".pdf,application/pdf"

and I've gotten as far as getting the website object:

$website  = gwmi -namespace "root\MicrosoftIISv2" -class "IISWebServerSetting" -filter "ServerComment like '%$name%'"
if (!($website -eq $NULL)) { 
    #add some mimetype
}

and listing out the MimeMap collection:

([adsi]"IIS://localhost/MimeMap").MimeMap

Anyone know how to fill in the blanks so that I can add mimetypes to an exiting IIS6 website???

© Stack Overflow or respective owner

Related posts about powershell

Related posts about iis6