今天刚好又用到了 IISAPP-A
然后想用 VBS 写一个脚本,让别人双击执行就能看
直接上脚本:
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set ps = objWMIService.ExecQuery("select * from Win32_Process where Name='w3wp.exe'")
Str="AppPoolId AppPoolName" & vbcrlf
For Each ps in ps
Str = Str & " " & ps.ProcessId & Space(10-len(ps.ProcessId)) & GetAppPoolId(ps.commandline) & vbcrlf
Next
WScript.Echo Str
WScript.Sleep 20000
Function GetAppPoolId(strArg)
On Error Resume Next
Dim Submatches,strPoolId,re,Matches
Set re = New RegExp
re.Pattern = "-ap ""(.+)"""
re.IgnoreCase = True
Set Matches = re.Execute(strArg)
Set SubMatches = Matches(0).Submatches
strPoolId = Submatches(0)
GetAppPoolId = strPoolId
End Function
Set ps = objWMIService.ExecQuery("select * from Win32_Process where Name='w3wp.exe'")
Str="AppPoolId AppPoolName" & vbcrlf
For Each ps in ps
Str = Str & " " & ps.ProcessId & Space(10-len(ps.ProcessId)) & GetAppPoolId(ps.commandline) & vbcrlf
Next
WScript.Echo Str
WScript.Sleep 20000
Function GetAppPoolId(strArg)
On Error Resume Next
Dim Submatches,strPoolId,re,Matches
Set re = New RegExp
re.Pattern = "-ap ""(.+)"""
re.IgnoreCase = True
Set Matches = re.Execute(strArg)
Set SubMatches = Matches(0).Submatches
strPoolId = Submatches(0)
GetAppPoolId = strPoolId
End Function
在此记录一下, 保存成 WBH.VBS 然后直接可以双击查看了
底层调的是 CScript.exe
浙公网安备 33010602011771号