I have a use case where i need to install a certificate, and the EXE wanting to do that needs to be run as the user. Automox runs as SYSTEM, is there anyway i can execute an EXE as another user (the logged in user) to install the certificate, without prompting the user?
only works properly IF there is a user currently logged on when you execute that command above. If the computer is turned on and no user is logged on, $currentusr will be NULL (actually, that line above will fail with an error since getowner().user won’t execute).
Since you want to install a certificate, you should check if there is a user logged on in the “Evaluation” section of the worklet. If no user is logged on, return 0.
If anyone is interested, I have a solution that allows your script to run in the context of the currently logged on user, and it gets triggered only upon user logon. This behaviour is very similar to how per-user GPOs are triggered. I’m waiting for Nic to approve my posting. 🙂
Hmmm post not yet approved. Maybe he is busy. Here it is anyway:
This PS code creates a scheduled task that is triggered on user logon, and it will run in the context of the user that just logged on. You can check the contents of the file c:\temp\out.txt to verify this.