Kaseya Community

Passing variables between executed procedures

This question is not answered

I have a script that I am finishing for CCleaner that does the following.

1. Executes a procedure to check the UAC setting, create a variable called UACStatus and then disable UAC

2. Runs CCleaner as logged on user

3. Executes another procedure to set UAC back to the what it was during step 1, this allow us to run CCleaner without issue, but leaves UAC set to the level desired by the customer

The procedure works great except for item 3; it does not set the procedure back to the variable UACStatus.

My question is this: Since steps 1 and 3 are actually another procedure that is being executed, is it not possible to pass the variable from one to another? If it is possible do I need to do something special to get the variable from the previous executed procedure?

All Replies
  • Procedure UAC HotSwitch Off before SW installation.zip

    Hi,

    this is a script I am using :

    2 scripts in zip file  :  do the 1st,  then whatever you need to execute,  then launch the second script,  when sw is installed or everything else you wanted to execute on an agent.

  • Standard variables only stay alive for the currently executing Procedure and only for Child, not parent steps. There are two ways you can achieve this:

    1) Use Global Variables - help.kaseya.com/.../index.htm

    2) Create your own local reg key to store settings and set it before and after (I personally prefer this approach as it's very persistent).

  • 2 things to watch for

    1)

    Make your variables Global .. i.e. instead of naming the variable just UACStatus and referencing it as #UACStatus# , name it Global:UACStatus instead and reference it as #Global:UACStatus#

    This gets around variables being passed up and down through IF/Then statements etc.

    2)

    Make sure the 2nd script called is set as "Execute procedure" . If you use the "Schedule Procedure" option it will not work as any link between the calling and called procedure is broken. So make sure when the first script calls the second script you use the "execute Procedure" option