1
到今天爲止,我使用的這個工具來判斷哪些W3WP屬於應用程序池其中W3wp.exe進程所屬的應用程序池在IIS6(使用PowerShell)
c:\windows\system32\cscript iisapp.vbs
我怎樣才能提取其相同的信息電源外殼? 或者,也許,更豐富的結果。
謝謝:)
到今天爲止,我使用的這個工具來判斷哪些W3WP屬於應用程序池其中W3wp.exe進程所屬的應用程序池在IIS6(使用PowerShell)
c:\windows\system32\cscript iisapp.vbs
我怎樣才能提取其相同的信息電源外殼? 或者,也許,更豐富的結果。
謝謝:)
這絕不是唯一的方法,但這裏是我使用的一種方法。這是針對PS v1的,有些代碼可以針對V2進行優化。
function get-apppools{
[regex]$pattern="-ap ""(.+)"""
gwmi win32_process -filter 'name="w3wp.exe"' | % {
$name=$_.name
$cmd = $pattern.Match($_.commandline).Groups[1].Value
$procid = $_.ProcessId
New-Object psobject | Add-Member -MemberType noteproperty -PassThru Name $name |
Add-Member -MemberType noteproperty -PassThru AppPoolID $cmd |
Add-Member -MemberType noteproperty -PassThru PID $procid
}
}
此輸出:
PS C:\Documents and Settings\jpogran> get-apppools
Name AppPoolID PID
---- --------- ---
w3wp.exe SharePoint - 9090 6988
w3wp.exe SharePoint - 80 6364
w3wp.exe foo.bar.net 4720
w3wp.exe SharePoint Central Administration v3 7960
w3wp.exe SharePoint - 8181 7756
的iisapp腳本顯示這一點:
PS C:\Documents and Settings\jpogran> iisapp
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
W3WP.exe PID: 6988 AppPoolId: SharePoint - 9090
W3WP.exe PID: 6364 AppPoolId: SharePoint - 80
W3WP.exe PID: 4720 AppPoolId: foo.bar.net
W3WP.exe PID: 7960 AppPoolId: SharePoint Central Administration v3
W3WP.exe PID: 7756 AppPoolId: SharePoint - 8181
PS C:\Documents and Settings\jpogran>