Posted on 05-16-2014 06:08 AM
I have been setting up multiple IIS servers for HTTP distribution points and was getting tired of manually changing the MIME types. Here is a super quick script for Windows Server with IIS7 to add the MIME types automatically:
cd %windir%system32inetsrv
rem Remove Existing MIME Types
appcmd set config /section:staticContent /-"[fileExtension='.dmg',mimeType='file/download']"
appcmd set config /section:staticContent /-"[fileExtension='.pkg',mimeType='application/octet-stream']"
appcmd set config /section:staticContent /-"[fileExtension='.mpkg',mimeType='application/vnd.apple.installer+xml']"
appcmd set config /section:staticContent /-"[fileExtension='.bom',mimeType='file/download']"
appcmd set config /section:staticContent /-"[fileExtension='.',mimeType='file/download']"
appcmd set config /section:staticContent /-"[fileExtension='.',mimeType='application/octet-stream']"
rem Add New MIME Types
appcmd set config /section:staticContent /"[fileExtension='.dmg',mimeType='file/download']"
appcmd set config /section:staticContent /"[fileExtension='.pkg',mimeType='application/octet-stream']"
appcmd set config /section:staticContent /"[fileExtension='.mpkg',mimeType='application/vnd.apple.installer+xml']"
appcmd set config /section:staticContent /"[fileExtension='.bom',mimeType='file/download']"
appcmd set config /section:staticContent /"[fileExtension='.',mimeType='file/download']"
appcmd set config /section:staticContent /"[fileExtension='.',mimeType='application/octet-stream']"
Posted on 06-10-2014 01:12 PM
So I have updated this a bit to be able to create the virtual directory and set the physical path credentials, I hope this helps someone else out. Make sure you change the DOMAINUSER and PASSWORD to your credentials needed for the setup.
cd %windir%system32inetsrv
rem Create Virtual Directory for CasperShare
AppCmd.exe ADD vdir /app.name:"Default Web Site/" /path:/CasperShare /physicalPath:S:CasperShare
rem Set the Physical Path Credentials for the Casper Read-Only User
Appcmd set vdir /vdir.name:"Default Web Site/CasperShare" /userName:"DOMAINUSER" /password:"PASSWORD"
rem Remove Existing MIME Types
appcmd set config /section:staticContent /-"[fileExtension='.dmg',mimeType='file/download']"
appcmd set config /section:staticContent /-"[fileExtension='.pkg',mimeType='application/octet-stream']"
appcmd set config /section:staticContent /-"[fileExtension='.mpkg',mimeType='application/vnd.apple.installer+xml']"
appcmd set config /section:staticContent /-"[fileExtension='.bom',mimeType='file/download']"
appcmd set config /section:staticContent /-"[fileExtension='.',mimeType='file/download']"
appcmd set config /section:staticContent /-"[fileExtension='.',mimeType='application/octet-stream']"
rem Add New MIME Types
appcmd set config /section:staticContent /"[fileExtension='.dmg',mimeType='file/download']"
appcmd set config /section:staticContent /"[fileExtension='.pkg',mimeType='application/octet-stream']"
appcmd set config /section:staticContent /"[fileExtension='.mpkg',mimeType='application/vnd.apple.installer+xml']"
appcmd set config /section:staticContent /"[fileExtension='.bom',mimeType='file/download']"
appcmd set config /section:staticContent /"[fileExtension='.',mimeType='file/download']"
appcmd set config /section:staticContent /"[fileExtension='.',mimeType='application/octet-stream']"
Posted on 01-31-2017 01:17 PM
Awesome, thanks for posting this! Very helpful.
Why do you need the entries with the fileExtension='.' ? I don't think we have been using those and have not noticed any issues.