使用WMI获取在远程计算机上运行的进程的当前内存利用率 [英] Get current memory utilisation of a process running on a remote machine with WMI

查看:253
本文介绍了使用WMI获取在远程计算机上运行的进程的当前内存利用率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个VB脚本,该脚本将返回远程计算机上进程的当前内存利用率.

I want to write a VB script that will return the current memory utilisation of a process on a remote machine.

我目前正在通过pslist.exe的输出来获取信息,但这并不理想.

I'm currently getting the info by greping the output of pslist.exe but that's not ideal.

推荐答案

可以使用 Win32_Process . WorkingSetSize?

Could you use Win32_Process. WorkingSetSize?

Set objWMI = GetObject("winmgmts:\\.\root\cimv2")
Set colObjects = objWMI.ExecQuery("Select * From Win32_Process")

For Each Item in colObjects
    WScript.Echo Item.Name & " - " & Item.WorkingSetSize
Next

当我在本地系统上运行该工具时,WorkingSetSize看起来与mem的使用字节相当.所以你除以1024得到Kb.

When I ran this on my local system the WorkingSetSize looked equivilent to the Bytes of mem usage. So you'd divide by 1024 to get Kb.

这篇关于使用WMI获取在远程计算机上运行的进程的当前内存利用率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆