Batches of Scripts - Start script from a script

I was just trying to modify a script I have that performs a Windows 10 upgrade on an asset if it was out of date. I thought it would be great if I could broadcast to the user that this is happening on their pc so they can ensure they leave their pc on.

The issue is, the script I have runs as System, and the broadcast message runs as Logged in User, but you can’t combine them.

This gave me an idea for a feature request to be able to Batch scripts together, to run in order from start to finish, as in a chain of scripts to happen back to back.

Or, if we could even get the ability to fire another script from within a script, that would work too.

Or figure out a way to run a broadcast message as system.

I was also thinking how I could set this up for the first script to create an alert, then run the automated remediation to fire off another script, but since Automated Remediation only runs every 15 mins, this wouldn’t work either. This would need to be instantly done to work properly.

1 Like

You can run a script as system and send message to all users. I don’t know that the syncro notice works but old school msg * “messsge here” works fine. I do this on some scripts now and it works good. Just the pop up box looks like the 1980s😉

It’s a bit of a hack, but in theory, you could create any secondary scripts as .bat/.ps1/etc. files, add them to the required files for that script (to be stored in something like C:\temp, then call them from within the main script. Though in your case, if the first script runs as a user, it might not work if you needed to call the second script as an administrator or the system account.

That said, I’d love to see the Syncro module updated to include something like “Start-Script -Scriptname ‘Second Script in Syncro Library’” to deal with sequences like this. I could see it being really handy.

This would be a great addition

I would also love to support this idea of calling another script from within a script.

My use-case is that I find myself doing prerequisite checks in multiple scripts. I would love to break this out into a single separate script that multiple scripts can reference. That way I’m only maintaining the prerequisite checks in one place instead of at the top of each script and I can call for the checks from any script where it is needed. This would help the scripts be much more maintainable overall.

@anon76526601 has the right idea to it into the Syncro module as a “Start-Script” command or something similar.

What is needed is to support a library of personal script libraries of functions that you can create, maintain and call.

Untested, but I remembered this post from Reddit …

I am all for building up a Github with scripts for Syncro. My vision would be a standard template we could build from that has a few assumptions like standard naming for custom Customer and Asset fields. I use things like a Customer nickname for short names of a customer to include in filenames. Standard private custom fields for repository URLs for larger client installer files. Same with some one-way upload locations to S3 folders for config backups and other asset specific files I want to backup offsite since Upload-File is so limited.