Kaseya Community

powershell in agent procedure

  • I currently have a agent procedure that runs a powershell script (powershellcommand64bituser) and it worked great on one machine during testing. I tried another test on a different machine and got a log entry stating.

    File C:\IT\Scripts\LogOffDisconnectedSessions.ps1 cannot be loaded because the
    execution of scripts is disabled on this system. Please see "get-help about_sig
    ning" for more details.
       + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordE
       + FullyQualifiedErrorId : RuntimeException

    okay no big deal just need to add the –ExecutionPolicy Bypass flag. I have tried added it before and after the path to the script. I have also tried adding the line to the powershell arguements and commands. 

    How do I add this to my agent procedure?



  • We could not find correct syntax either so we use this command in a executeshellcommand command instead as the first line item in the Kaseya script, then run the .ps1 file

    powershell -command "& {Set-ExecutionPolicy Bypass}"

  • Thanks, This really should be a default setting. I take it you put the setting back when done? That will be my current plan.