Kaseya Community

Running GPResult against the machines in my enterprise fails

This question is not answered

I am using a Modified script from "Ping IP Address 1" to run GPRESULT /R against the machines in my enterprise.  I am running the latest version of Kaseya 9.4.

Here is the script:

If True

  getVariable("Agent Working Directory Path", " ", "agentTempDir", "All Operating Systems", "Halt on Fail")

  executeShellCommand("gpresult /R >>"#agentTempDir#\gpresult.txt"", "Execute as System", "All Operating Systems", "Halt on Fail")

  getVariable("File Content", "#agentTempDir#\gpresult.txt", gpresult1", "All Operating Systems", "Halt on Fail")

  executeProcedure(GPResult", "0", "Immediate", "All Operating Systems", "Halt on Fail")

I have tried execute as System and execute as User and no gpresult.txt file is created.  I see "Last Exec Status" as 'Script Summary: Falied THEN in step 4 (Line 6). 

I can't seem to figure out why this script won't work or what I may have incorrectly placed into the script.  Any help is appreciated.



All Replies
  • It looks like you have the shell command using a kaseya variable. This might now work. You might try using a complete path instead.

  • It's #vAgentConfiguration.AgentTempDir# not just agenttempdir.

  • And no need to getvariable() - it's a system variable so delete line 1.

  • I removed the first line and I am still getting an error.  Failed in Step1, Line 3.

    Since I removed the 1st line I assume I didn't need the 1st modification.

  • I tried running a one line procedure:

    executeShellCommand("gpresult /R >> "#vAgentConfiguration.AgentTempDir#\gpresult.txt"", "Execute as System", "All Operating Systems", "Halt on Fail")

    And I was able to get the gpresult.txt file in the Agent folder.

    Try doing this, from my understanding if all you want is the log file you don't need more than this one line.