Kaseya Community

Variables from one script to another

This question has suggested answer(s)


i'm not a real scripting guru so i thought i ask.....

i've create a script that create's a GLOBAL variable (based on a regkey) so far no problem, here comes the deal:

next step in my procedure is "schedule procedure" on a different target machine and use the variable i just grabbed

using #GLOBAL:varname# should do it according to the docs and K-Support but it just does not work

any suggestions?

thanks !

All Replies
  • is anything to do with the fact that you are scheduling the script to run at a later date I assume rather than running it now

    So script 1 runs Script 2 immediately and passes variable - where in your case Script 1 schedules script 2 to run in a hour and the variable is not passed as it is not kept active.

    Just a possible

    On that note why oh why do they not have the schedule window here to say run this script next friday at 2pm instead of that rubbish X Minutes... (rant over)

  • the second script i fired directly from the first to run "immediately"

  • Using "Execute Procedure" it works fine, but using "Schedule Procedure" does not pass the Global variable.

  • Dan is correct you can't pass normal script/procedure variables or global script variables via Procedure to a "Scheduled Procedure". It only works with Execute procedure which only works on the same machine agent.

    Your only options (at this point and time) are Managed variables or meta files (text files with variable data) in a centralized depository.  

  • @ Dan & HardKnoX - Thanks - i was afraid for that !

    @ HardKnoX - is it possible to change a managed variable from within an agent proc? where do i store the meta files ? (already thought of that but i cannot thin of a way to store it so both script can access it)

  • Well there are a few places where you can store the meta files you can use the Kaseya server's "VSASharedFiles" path that you use to write file to machines, the path you want to use with the "Get File" command for your meta file is:


    Note the "..\..\..\" takes you out of the "..\Kaseya\UserProfiles\(MachineGUID)\GetFiles" folders on the server and then puts it in the ..\Kaseya\WebPages\ManagedFiles\VSASharedFiles\ folder space.

    You can make a network share or use an existing network share and add the path to a "managed Variable", I call mine <FILESHARE> and you could upload the file to it.

    Or you can use the Kaseya patch depository (if you have one) the Database Select Views variable name for it is: #vPatchConfiguration.FileSourceUNCPath#

  • just make sure to be neat and make a sub folder under the "VSASharedFiles", patch depository or FileShare you could even use the agent GUID to make unique folders.

    The Database Select Views variable for AgentGuid is: #vAgentConfiguration.agentGuid#, you would want the GUID to be the target machine as you normally use them when scheduling procedures via a procedure anyways...

    [edited by: HardKnoX at 2:41 PM (GMT -7) on 11-4-2010] Update
  • thanks for the help !

    i am gone try !