Link to home
Create AccountLog in
VB Script

VB Script

--

Questions

--

Followers

Top Experts

Avatar of rimmena
rimmena

Using a vbscript for perfmon counters
I am looking to monitor a process on 6 servers, but only use the following counter:

Process(*)\Virtual Bytes

Looking for a script that will retrieve the value for this counter for each server, then write it to a log file.

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of ScottyworldScottyworld🇳🇿

Hi Rimmena,
Just so I know I've got the right process counter, can you just run the following script to check its returning the correct value, as there's several different process memory counters to choose from...
Once you've confirmed I have the right one I can modify it to check all your servers and output to a text file (or an on-screen prompt if that would be preferred)

This will list all current processes and the virtual memory they are using
Set objWMI = GetObject("winmgmts:\\.\root\cimv2") 
Set colObjects = objWMI.ExecQuery("Select * From Win32_Process")  
For Each Item in colObjects
	WScript.Echo Item.Name & " - " & Item.VirtualSize
Nex

Open in new window


Avatar of rimmenarimmena

ASKER

Yes, that's the right one. Thanks

ASKER CERTIFIED SOLUTION
Avatar of ScottyworldScottyworld🇳🇿

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

Avatar of rimmenarimmena

ASKER

Have run script with server names and it displays finished, but nothing is written to the log file. I commented out 'On Error Resume Next, but get no errors either ??

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


Avatar of ScottyworldScottyworld🇳🇿

Thanks for the points - did you resolve the writing to the log file, or do you need me to take a look?

Avatar of rimmenarimmena

ASKER

Yes I resolved it, the process name was case sensitive, thanks.

Avatar of ScottyworldScottyworld🇳🇿

You can get round the case sensitive bit by changing line 25 to:

If Lcase(Item.Name) = Lcase(strProcess) then

this will convert everything to lowercase before doing the comparison.
Just looking at some of my processes, it may be better to do this in case you ever run it against a different process in the future

Free T-shirt

Get a FREE t-shirt when you ask your first question.

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.

VB Script

VB Script

--

Questions

--

Followers

Top Experts

VBScript (Visual Basic Scripting Edition) is an interpreted scripting language developed by Microsoft that is modeled on Visual Basic, but with some important differences. VBScript is commonly used for automating administrative and other tasks in Windows operating systems (by means of the Windows Script Host) and for server-side scripting in ASP web applications. It is also used for client-side scripting in Internet Explorer, specifically in intranet web applications.