-
Notifications
You must be signed in to change notification settings - Fork 149
IisMimeTypeMapping
dscbot edited this page Oct 23, 2024
·
3 revisions
Parameter | Attribute | DataType | Description | Allowed Values |
---|---|---|---|---|
ConfigurationPath | Key | String | This can be either an IIS configuration path in the format computername/webroot/apphost, or the IIS module path in this format IIS:\sites\Default Web Site. | |
Extension | Key | String | The file extension to map such as .html or .xml. | |
MimeType | Key | String | The MIME type to map that extension to such as text/html. | |
Ensure | Write | String | Ensures that the MIME type mapping is Present or Absent. |
Present , Absent
|
The IisMimeTypeMapping
DSC resource is used to...
- Target machine must be running Windows Server 2012 R2 or later.
All issues are not listed here, see here for all open issues.
configuration Sample_IisMimeTypeMapping_RemoveVideo
{
param
(
# Target nodes to apply the configuration
[String[]] $NodeName = 'localhost',
# Name of the website to modify
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String] $WebSiteName
)
# Import the module that defines custom resources
Import-DscResource -Module WebAdministrationDsc, PSDesiredStateConfiguration
Node $NodeName
{
# Install the IIS role
WindowsFeature IIS
{
Ensure = 'Present'
Name = 'Web-Server'
}
# Remove a bunch of Video Mime Type mappings
IisMimeTypeMapping Mp2
{
Ensure = 'Absent'
Extension = '.mp2'
MimeType = 'video/mpeg'
ConfigurationPath = "IIS:\sites\$WebSiteName"
DependsOn = '[WindowsFeature]IIS'
}
IisMimeTypeMapping Mp4
{
Ensure = 'Absent'
Extension = '.mp4'
MimeType = 'video/mp4'
ConfigurationPath = "IIS:\sites\$WebSiteName"
DependsOn = '[WindowsFeature]IIS'
}
IisMimeTypeMapping Mpeg
{
Ensure = 'Absent'
Extension = '.mpeg'
MimeType = 'video/mpeg'
ConfigurationPath = "IIS:\sites\$WebSiteName"
DependsOn = '[WindowsFeature]IIS'
}
# we only allow the mpg and mpe Video extensions on our server
IisMimeTypeMapping Mpg
{
Ensure = 'Present'
Extension = '.mpg'
MimeType = 'video/mpeg'
ConfigurationPath = "IIS:\sites\$WebSiteName"
DependsOn = '[WindowsFeature]IIS'
}
IisMimeTypeMapping Mpe
{
# Ensure defaults to 'Present'
Extension = '.mpe'
MimeType = 'video/mpeg'
ConfigurationPath = "IIS:\sites\$WebSiteName"
DependsOn = '[WindowsFeature]IIS'
}
}
}
- Home
- IisFeatureDelegation
- IisLogging
- IisMimeTypeMapping
- IisModule
- SslSettings
- WebApplication
- WebApplicationHandler
- WebAppPool
- WebAppPoolDefaults
- WebConfigProperty
- WebConfigPropertyCollection
- WebSite
- WebSiteDefaults
- WebVirtualDirectory
- xIisFeatureDelegation
- xIisHandler
- xIisLogging
- xIisMimeTypeMapping
- xIisModule
- xSslSettings
- xWebApplication
- xWebAppPool
- xWebAppPoolDefaults
- xWebConfigKeyValue
- xWebConfigProperty
- xWebConfigPropertyCollection
- xWebSite
- xWebSiteDefaults
- xWebVirtualDirectory