Runs script as logged on user trough RMM

Does anyone know if it’s possible with Python to run a script trough RMM as the logged on user. By default, it runs as the system account, but there is no interaction with the desktop. PowerShell has a module called RunAsUser.

You can then execute the script trough RMM without knowing the credentials from the logged on user.
Is this possible with Python?

Python has no ability to over-ride the operating system and defeat its user management. If it could, that would be a HUGE security vulnerability – malware could defeat the OS just by calling a bit of Python code.

You will have to work out how to do the task you want using your operating system’s user management, and then do the same thing using Python.

In Linux and Unix systems, there is su and sudo, which have their own pros and cons. On Windows, I believe you can check “Run with Different Credentials” in the file properties.

I believe that in either case, you can only downgrade privileges without knowing the user credentials. So the Admin account can run as any unprivileged account, but an unpriviledged account would have to know the credentials to run as Admin.

You can look at the Windows runas program:

I expect the best thing is to read the docs for your RMM software and see what they say about running as the logged in user.

thanks for your answer, the RMM only support thw workaround with the powershell module. There are several RMM solutions that support this feature, like Syncromsp and Atera. You have an option to run a script as user or as system account. For now i compile my python script to exe and run it with the powershell module, thats working. Would be nice if i skip this and run from python