Calling scripts within a script

AW
Adam Williams Silver Contributor
Panasonic Manufacturing UK Ltd - CPE

Hi,

I have a number of managed legacy scripts (e.g. script1 and script2)

Is it possible to call a number of these within a legacy script

E,g, Send script

script//:script1

script//:script2

(Sorry no idea of the possible syntax)

Thanks

Adam

3 years ago
SOTI MobiControl
ANSWERS
RS
Rafael Schäfer Diamond Contributor
3 years ago

Not as far as i know (via console).

Then you have to merge them together and send them then as a seperated script.

If you are able to do API calls, you can do it there.

AW
Adam Williams Silver Contributor
3 years ago

Hi Rafael,

Thanks for answering.

Just to confirm your answer, by "merging" you mean copy & pasting the contents of the scripts into another?

Thanks 
Adam 

RS
Rafael Schäfer Diamond Contributor
3 years ago

Yes

RC
Raymond Chan Diamond Contributor
3 years ago

Hi Adam,

The answer can be yes or no, depending on whether the scripts are totally independent and do not need any parameter passing and data sharing.

If so, the scripts might be included as pre-scripts in different .pcg packages with no .apk or data file contents, and the main script can use installpackage commands to run these pre-scripts of various packages. Depending on the actual commands used, there might be some limitations in this approach, but there can be workarounds depending on the agent versions or other factors.

AW
Adam Williams Silver Contributor
3 years ago

Thank you for the suggestion Raymond, im sure I can make use of this.

Adam

RS
Rafael Schäfer Diamond Contributor
3 years ago

For sure if you want this as a one-time solution Raymonds idea is valuable.

But if you want to do this on regular base lik you use the "send script" console functionality, this isn't really an good way to do because you have to revoke and reinstall (or force package reinstallation if on a single device) to get it done again.

RC
Raymond Chan Diamond Contributor
3 years ago

Hi Adam,

The approach is definitely not a one-time solution.

When using .pcg package pre-script to support script calling script, the pre-script in the .pcg packages are NOT meant to be run with packages inside profile being installed/re-installed/revoked. 

Instead, the library of.pcg packages should be delivered once to pre-defined device folder with a file-sync rule or a single super .pcg.   After that, any script initiated with whatever method (e.g. interactive send-script action, Out-Of-Contact script, speed kiosk, file-sync pre-/post-script, schedule task profile payload, ..., etc.) supported by MobiControl can repeatedly include the installpackage command with the right package's folder path to run any of the scripts desired.