内容显示页
 
类别:ASP+VBS | 浏览(1096) | 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
---------------------------
确定  
---------------------------


引用:
vbs显示w3wp.exe进程PID及应用程序池名
http://www.yongfa365.com/item/GetAppPoolId.vbs.html
 
 
相关链接
 
网友评论:
1 雨中风铃 - 2011-2-13 21:03:25
IIsApp.vbs中的代码
 
姓名: 记住我
网址:
邮箱:
内容:
验证码:  验证码图片 看不清? 换张图试试
 
     
 
 
文章分类
 
 
.Net + C#(74)
 
 
ASP+VBS(161)
 
 
 
Linux(10)
 
 
 
web 2.0(26)
 
 
 
 
 
心程(68)
 
生活(97)
 
 
     

Power by :柳永法(yongfa365)'Blog  | 京ICP备07011491号  QQ:64049027  E-mail:64049027@qq.com Weibo

申请友情链接 要求:跟本站主题相类似正规网站,双方交换为首页位置

转载请注明来源,以便后人及时得到最新、修正、加强版!!!