Detect if a 2nd user is logged in

Hi Community :wave:

I am trying to detect if a second / third user is logged on (ie 2+ robots on 1 VM).
I have tried the CMD method using “query user”. It’s not bad but when scraped, might be not the simplest solution to confirm a single user logged on.

Option 1 - Scrape CMD text
And check for a second User ID like this.

Option 2 - Scrape Task Manager text
Open Task Manager and scrape ‘Users’ tab. Something like this.

What I am looking for is feedback / input on other ideas/ways to check for a additional users.

Screenshot of 2 Users - Task Manager

Screenshot of 1 User - Task Manager

The purpose of this solution will be restart a VM if a single user is logged on.
If single user = Restart VM
If second user detected = abort Restart of VM.

Happy for any / all input on these ideas :blush:




I had two options to suggest you

First with thread where I had seen a similar scenario
Hope would give u some ideas

And I have wondered on how this activity will work

Cheers @Steven_McKeering