2
这里是行不通
>dir IIS:\AppPools\ | % { dir IIS:\AppPools\$_.Name\WorkerProcesses }
更多信息
我想使用Powershell来获取每个应用程序池的PID。我知道我可以使用WMI来获取如下命令的信息,但我正在尝试使用Powershell的Web管理模块。
WMI方法(工作样本)
Get-WmiObject -NameSpace 'root\WebAdministration' -class 'WorkerProcess' -ComputerName 'host' | select AppPoolName, ProcessId | ft -a
AppPoolName ProcessId
----------- ---------
MSExchangePowerShellAppPool 5432
MSExchangeServicesAppPool 3604
MSExchangeOWAAppPool 7056
MSExchangeAutodiscoverAppPool 6012
DefaultAppPool 3288
MSExchangeSyncAppPool 2944
Powershell的方法(不工作样本..帮助!)
如何将二者结合起来的输出命令(也许作为一行)也给我每个应用程序池的PID?
[PS] C:\Windows\system32>import-module WebAdministration
[PS] C:\Windows\system32>dir IIS:\AppPools
Name State Applications
---- ----- ------------
Classic .NET AppPool Started
DefaultAppPool Started Default Web Site
/Rpc
/RpcWithCert
/ArchiveProxy
MSExchangeAutodiscoverAp Started /Autodiscover
pPool /Autodiscover/bin
/Autodiscover/help
MSExchangeECPAppPool Started /ecp
MSExchangeOWAAppPool Started /owa
/owa/oma
/ArchiveProxyOwa
MSExchangeOWACalendarApp Started /owa/Calendar
Pool
MSExchangePowerShellAppP Started /PowerShell
ool
MSExchangeServicesAppPoo Started /EWS
l /EWS/bin
MSExchangeSyncAppPool Stopped /Microsoft-Server-ActiveSync
第二个查询我想结合是这样的:
[PS] C:\Windows\system32>dir IIS:\AppPools\DefaultAppPool\WorkerProcesses | fl
processId : 3904
Handles : 89516
state : Running
StartTime : 2/19/2013 10:34:57 PM
尝试DIR IIS:\ AppPools \ |选择 - 展开名称| %{dir IIS:\ AppPools \ $ _ \ WorkerProcesses} – 2013-02-21 15:05:26
@Kayasax这是可行的!如果你张贴作为答案,我会给你+25代表 – LamonteCristo 2013-02-21 15:42:54