It is not a problem run a powershell script when user has admin rights on pc.
But can't get it to work when user is not admin.
Tried various combinations , usecredentials and executepowershellasuser, executepowershell, impersonate user etc...
Non of them is working for me.
Local execution of powershell works.
Generally, I copy script to working directly and then execute it. No errors in log procedure.
It seems it was a problem with kaseya agent itself. I reinstalled agent on that machine and it works.
I used executepowershellasuserx64 as a settings.
I also encountered this problem and opened a ticket in Kaseya. Their reply:
If this command needs to be run as administrator, then it will unfortunately not
run via Agent Procedure as agent procedure does not have a method of running commands with elevated permissions. Please see the following tech jam that
explains this further: www.youtube.com/watch