powershell – 在Power Shell脚本中获取IIS的应用程序池标识

前端之家收集整理的这篇文章主要介绍了powershell – 在Power Shell脚本中获取IIS的应用程序池标识前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
尝试在IIS中获取特定名称的应用程序池标识,例如:Test

成功通过下面的代码得到它,但不想循环通过所有的webapps,是否有任何容易通过指定名称得到它?

Import-Module WebAdministration
Get-WebApplication

$webapps = Get-WebApplication
$list = @()
foreach ($webapp in get-childitem IIS:\AppPools\)
{
    $name = "IIS:\AppPools\" + $webapp.name
    $item = @{}
    if ($webapp.name -eq 'Test')
    {        
        $item = $webapp.processModel.identityType   
        break
    }
}


echo $webapp.processModel.identityType
只需组合路径并检索项目.这将有效:
$item = Get-Item (Join-Path 'IIS:\AppPools\' 'Test') | 
   select -ExpandProperty processModel | 
   select -expand identityType
原文链接:https://www.f2er.com/bash/384628.html

猜你在找的Bash相关文章