Script fails with this message: ... it was run as the logged in user, and no user is currently logged in

So I tried running a script on an asset (a simple workstation - Desktop) that had been powered on and synching with Syncro but had been idle for 72 hours, and the script failed with this message: “This script failed to run because it was run as the logged in user, and no user is currently logged in.”
Syncro shows the last user as Patti which is correct. I’m assuming that while the computer was in an idle state, it logged out the current user?
Is there a way to make sure a user is logged in while attempting to run a script in Syncro as a “Logged-In User”?

Last user and logged in user are not one in the same for Syncro. You can usually refresh the page and view the thumbnail to get an idea if someone is logged in or not. The behavior I’ve experienced here is, if no one is logged on, then I get no thumbnail. If someone is logged on and the screen is locked, I can see the locked screen. As to your question, no, you cannot tell a script to run after the user has logged on, it will just fail. I’d love to have a way to queue up a user script, I think this was requested somewhere.

There is a good chance they are just reading the LastLoggedOnUser from the Registry

You can try this yourself with the Syncro Backgrounding Tools > Terminal or ConnectWise Control Backstage sessions. Just log someone off, and then run this command and you can see that they are still the last person shows as logged on.

Get-ItemProperty Registry::HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI -Name LastLoggedOn*

For an idea of the current sessions on a machine - I would recommend running quser.exe It will give you an idea of if there are any sessions, connected or disconnected, and how long they have been idle for

In certain more specialized cases - mostly related to RDS or Terminal Servers - qwinsta might be a better and more detailed option, but there is definitely more to work through then too

But, hey, more detail is more detail!

Thanks Jimmie, I’ll put that info to good use.

Thank you KevinC. I think I’ll be putting the quser.exe to use soon.

Unfortunately, no, there is not a good way. You could of course run a system script to check for output from quser.exe and then have that trigger your script that can only run as the logged in user. The problem I ran into with this is that most things I wanted to run as the logged in user I did not want to happen repeatedly, but I did want them to happen once. To make the system script trigger an alert that an AR would handle by running your User mode script you’d have to just run the system script on a schedule or be ok with all the assets with no logged in user getting skipped.

I put in a feature request a year or so ago for User space scripts to handle users being logged in the same way the system handles the asset being offline. If this would be helpful for you would be worth opening a new feature request for.