Kaseya Community

Get file Agent Procedure - How?!

  • I'm stuck on this step for creating Get File on Agent Procedures:

    "Enter relative path and filename to save the file at on the Kserver. Each machine has its own private structure.:" What is an entry here supposed to look like? My scripts keep failing on this step.

    Please help.

    Thanks in advanced.

  • Well the Kserver side is easy as it will put the file under the agent's "get file" location.

    The file that you are trying to get is another matter and it will take some R&D as it is depended on the file.

    If it is a log file that you have created using the pipe to text command prompt option then its a good idea to place them in your kworking folder. To make it simple use the Database Views variable; #vAgentConfiguration.AgentTempDir# for this. Its good practice to create a sub folder as the kworking folder can get messy.

    E.g.: Execute Shell Command: MKDIR #vAgentConfiguration.AgentTempDir#\Temp \a

    Files under the "Program Files" folder will be dependent on if the OS is 64bit or not and if the application is 64bit or not. You can use an if statement to check for the file in both places to get around this.

    Windows system files is bit more tricky especially with Windows 7 64bit but most of the the time you can use the Windows variables (run set to get these). %WINDIR% is the most common one I use just for in case the installation drive or path is not C:\Windows.

    To give you an example on how it works;

    Get File -  Step Options

    Enter the full path and filename of the file to get from the remote machine.:

    Logs\mylog.log

    Enter relative path and filename to save the file at on the Kserver. Each machine has its own private structure.:

    #vAgentConfiguration.AgentTempDir#\Temp\mylog.log

    Specify whether to retain the last version of the file and whether to send alert when file changes (see Alerts module).:

    Overwrite existing file without alert

  • Also it is good practice to check if the file exists using an IF statement and if it does not exist skip the Get File command and a write "Missing File" entry to the Agent Procedure log.

  • Thanks guys. I've gotten it to work now. Much thanks!



    [edited by: aabbasi at 6:01 PM (GMT -7) on 11-1-2010] Tested and working.
  • but what is the "relative path and filename to save the file at on the Kserver" ?

  • Assuming Kaseya is installed to the C: Drive then the getfile path is typically

    C:\Kaseya\UserProfiles\AgentGuid\GetFiles\....

    e.g. 

    C:\Kaseya\UserProfiles\194711984199957\GetFiles\.....

    Where 194711984199957 is the agentguid of the individual machine