Monitor a process from specific user with Process.CountEx fails
-
Hi,
I have to monitor if a process is running under a specific user in Windows.I use Process.CountEx for doing that.
In Taskmanager the username is shown like AD001\z004abcd
Processname is EB_BPM.exeI tried: Process.CountEx("EB_BPM.exe",,"AD001\z004abcd")
and ( in case the Backslash is the problem): Process.CountEx("EB_BPM.exe",,"(?i)z004abcd")Both fail.
Using just Process.CountEx("EB_BPM.exe") works, but I need to have the username.Using NetXMS 5.2.1
Any idea?Stefan
-
Did you try
Process.CountEx("EB_BPM.exe",,"z004abcd")
? -
I tried. It's also not working. Always returning 0.
In logfile with Loglevel 7 I find:
2025.06.23 09:08:32.521 *D* [comm.cs.1 ] Requesting metric "Process.CountEx("EB_BPM.exe",,"z004abcd")"
2025.06.23 09:08:32.555 *D* [comm.cs.1 ] GetMetricValue("Process.CountEx("EB_BPM.exe",,"z004abcd")"): 0 (SUCCESS) value = "0"But the process is running.
-
-
how do you see this process in "Processes" view for that node?
-
-
Well, that explains why the metric does not return what you expect.
How do you run the agent - under SYSTEM user or in some other way?
-
-
Please try to run the agent under system user to see if that makes any difference
-
-
Agent uses GetSecurityInfo win api function, please check information about needed access rights here:
https://learn.microsoft.com/en-us/windows/win32/api/aclapi/nf-aclapi-getsecurityinfo#remarks
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login