I am relatively new to Grafana and have been very successful setting up all sorts of Windows monitoring using Telegraf and Influx. One thing I am struggling with is the ability to get the current user from a ‘client’ machine, not the Grafana user. After a bit of searching I did not see any Dashboards which did this so attempted to just get the output of the powershell script into Telegraf. That also didn’t work, I was able to push numeric/integer data, but not ascii/string data. Goal is just to get the current user on our lab systems and seems like something that should be fairly simple, but alas it appears not. Any tips would very much appreciated!
[[inputs.exec]]
command = “powershell C:/scripts/GetUser2.ps1”
name_override = “Users”
data_type = “string”
timeout = “30s”
data_format = “influx”
Simple Ps1 to return current user
(Get-WmiObject -Class Win32_Process -Filter ‘Name=“explorer.exe”’).
GetOwner().
User