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?
Ok well after much frustration and research, this is the solution I’ve come up with…
a) Grab the COM DLL “Interop.IISOle.dll” and put it somewhere easily referenced
(eg. reference the COM component “Active DS IIS Namespace Provider” in a dummy project, build and grab the DLL from the bin folder)
b)
c) Sample usage:
References: Can I setup an IIS MIME type in .NET?