内容显示页
 
类别:ASP+VBS | 浏览(140) | 2007-12-26 17:53:09
'/*=========================================================================
' * Intro       在服务器上运行此文件,5秒内会弹出一个窗口,显示内容为iis进程的PID及所在的应用程序池,以便与观察哪个应用程序池占资源大
' * FileName    GetAppPoolId.vbs
' * Author      yongfa365
' * Version     v1.0
' * WEB         http://www.yongfa365.com
' * Email       yongfa365[at]qq.com
' * FirstWrite  http://www.yongfa365.com/Item/GetAppPoolId.vbs.html
' * CreateTime  2007-12-26 17:49:20
' * LastModify  2007-12-26 17:49:20
' *==========================================================================*/

'显示所有应用程序池当前PID及应用程序池名
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


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

运行后会弹出类似这样的窗口:

---------------------------
Windows 脚本宿主
---------------------------
AppPoolId  AppPoolName
  3872      yongfa365_com
  5284      DefaultAppPool
  7688      net2_0
  5596      AppPool-2
  4716      net1_1
---------------------------
确定  
---------------------------


引用本页地址:http://www.yongfa365.com/item/GetAppPoolId.vbs.html
 
 
相关链接
 
网友评论:
姓名: 记住我
网址:
邮箱:
内容:
验证码:  验证码图片看不清? 换张图试试
 
   
 
 
文章分类
 
 
专题(3)
 
ASP+VBS(141)
 
 
 
 
Linux(10)
 
 
SQL(55)
 
web 2.0(22)
 
 
 
 
 
 
心程(48)
 
生活(71)
 
创业(5)
 
   

power by :柳永法(yongfa365)'Blog | model by :hibaidu | css by:众网友 | 京ICP备07011491号   我要统计  

本空间赞助商:北京中科兴联信息技术有限公司

QQ:64049027    E-mail:64049027<at>qq.com