Powershell 检查 IIS 中是否存在 MIME

标签 powershell iis mime

我有以下命令可以使用 PowerShellMIME 类型添加到 IIS

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

如何在调用 add-webconfigurationproperty 之前先检查 MIME 类型是否存在?

最佳答案

您可以检查以下内容:

if( !((Get-WebConfiguration //staticcontent).collection | ? {$_.fileextension -eq '.xpa'}) ) {
  #do something
}

关于Powershell 检查 IIS 中是否存在 MIME,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28431497/

相关文章:

c# - 使用 javascript 获取 Windows 用户名

authentication - iis7 Challenge-based 和 login redirect-based 认证不能同时使用

php - 如何在 Linux 上扩展 magic.mime

Java邮件 : distinguish between each message in an email thread

sharepoint - 如果使用WinRS,PowerShell为什么不起作用?

azure - Powershell 和 Azure 资源资源管理器显示不同的属性集

powershell - Set-Variable foo -Scope Global -Value "bar"和 $global :foo = "bar" 之间的区别

mysql - 如何使用mysql查询发送带附件的电子邮件

regex - 带有命名组的替换字符串中的 Powershell 变量

c# - 获取文本文件的 mime