![](/img/trans.png)
[英]How do I check if user 'IIS AppPool\MyAppPoolName' exists in powershell
[英]Powershell Check MIME exists in IIS
我有以下命令使用PowerShell
向IIS
添加MIME
类型
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
}
您还可以使用以下方法检查是否存在“属性”:
if (!(Get-WebConfigurationProperty //staticContent -Name collection[fileExtension=".xpa"]))
{
Write-Host ".xpa doesn't exist"
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.