Kaseya Community

Write File using variable name

  • Hello. Looking for a little help...

    The scripting Write File command asks for the full path and filename of the destination file and also the source file stored on the server.

    It is possible to use variables for the path/fielname for the desination file, but the source file is a dropdown box. I would like to use a variable name in the source file.

    Is this possible?

    Thanks very much in advance.

    Lloyd

    Legacy Forum Name: Write File using variable name,
    Legacy Posted By Username: lwolf
  • No. You have to pick one of the available files on the kserver.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: Lmhansen
  • I don't think this would be very practical, but what if I exported the script, copy text to notepad, inside notepad chaneg the text for the filename to include the variable, then reimport? That gets past the dropdownlist requirement on the Kaseya User Interface. But I am nto sure if it would actually resolve properly at script run tim.

    I will have to try this. Shoudl be pretty easy to test.

    Lloyd

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: lwolf
  • What sort of variable are you trying to use in the source file? Please explain what your goal is and there may be an alternative way to accomplish it.

    Michael

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: RCS-Michael
  • RCS-Michael,

    One example would be the use of JKDEFRAG for defragment scripts. I may want to download and then run 1 of 4 different files (32-bit or 64-bit, command line or graphcial display) from my kserver.

    Instead of making 4 different scripts, I wanted to assign the filename to a variable at the beginning of the script, and then refer to that variable whenever downlaoding the file from the kserver or when executing the file on the managed computer. I have the variable name working perfectly for executing the file on the managed computer, but I am having trouble tryign to specify the name of the file to download from the kserver.

    Lloyd

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: lwolf
  • I see. I don't think there's a way to do what you want unless you host the files somewhere accessible via URL. Then, use the Get URL script primitive rather than the Write File primitive. The other option would be to stage all four files on all computers and then call the appropriate file when needed.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: RCS-Michael