Kaseya Community

Agent not executing Local Powershell script

  • I am having a issue where I have a written powershell script that functions correctly and I'm pushing it out from the Kserver to local clients.  I'm using the write file function to get the powershell file to the client machine.  However, I am using the execute shell command function to execute this command powershell.exe -command C:\temp\DS1.ps1.  I have ran this agent procedure on my local machine and it worked, but when i try to push it out to another windows 7 machine it copies the script, but fails at running the script.   I have checked the execution policy and it is set to unrestricted  and if i run the script locally it works correctly.  So does anyone have any advice on what possibly could be the issue?

     

    Thanks    

  • Check and make sure powershell is installed to the clients your script is running from, plus make sure it is up to date.

  • Is this a script that interacts with the local profile? is KaUsrTsk.exe running? if not start it and try to push the script again. If this solves your problem, ensure the startup regkey has this listed or put a short cut for it in the all users startup

  • Is the execute command running under logged in user or system account? If it is set for logged in user try using system account.

  • @ David  I checked the host and it was running powershell 2.0.

    @Danrche I looked at the client and the KaUsrtsk.exe was running, but it didn't work on either the local computer or on the workgroup log on.

    @Bmazzotti I have it checked to run on the system account.

    Thanks again for the help!

  • Randall, did you get it sorted out?

  • Yeah I got it working I ended up rebooting the machine and then tried pushing the script out again and it worked.  

    Thanks, for asking about it Danrche I appreciate it.