• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
皇图霸业谈笑间
更高、更快、更强
博客园    首页    新随笔    联系   管理    订阅  订阅
关于查W3WP应用程序池用VBS脚本编写的方式

今天刚好又用到了  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 

 

在此记录一下, 保存成  WBH.VBS  然后直接可以双击查看了

底层调的是 CScript.exe

posted on 2012-02-22 17:24  布颜书  阅读(222)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3