Get current memory utilisation of a process running on a remote machine with WMI

大憨熊 提交于 2019-12-13 01:57:39

问题


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

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


回答1:


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

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.




回答2:


Maybe you can use WMI to remotly read performances conter on the remote machine.

http://msdn.microsoft.com/en-us/library/aa392397(VS.85).aspx



来源:https://stackoverflow.com/questions/701904/get-current-memory-utilisation-of-a-process-running-on-a-remote-machine-with-wmi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!