I would like to monitor if a specific user is logged in. We have a specific user account that automatically logs in when a Windows machine is booted up. We need to know if that account was successful in logging in or not. Ideally, it would return a status of "up" if the user is logged in or a status of "down" if the user is not currently logged in.
For example, if userA is logged in, it would return a status of "up". If userB is logged in, it would return a status of down. Also, if no one was logged in, it would also return a status of down.
We'd then like to display this in a custom table with the server name, username, and whether status is up or down.
You can use a custom powershell script to check for the logged on users, filtered for the account you want to check. Set up a condition where if the account is not it should exit with a 1 (Down), otherwise exit with a 0, you will need a statistic but honestly for a simple check like this you could just hard code in any number as the stat value.
See this documentation