Hi guys! First post on the community forums, but I thought I’d share a system I’ve been using and tweaking for a year now. I take no credit for all the functions in this script. Many of them are adapted from the community scripts and other sources.
One of the issues I had when we moved to Syncro is cleaning up scripts we incorporated into our environment. Some scripts create a temp on the root of the drive, others use the user temp directory, others C:\Windows\Temp. I wanted a clean interface for adapting and implementing scripts, but more importantly I wanted to keep our client environment clean and organized. I needed something for our techs learning PowerShell to quickly and easily adapt to, without a huge learning curve
Initially I had four templates for use, Standard script, Randomized Start script, Ticket Creation script, and Maintenance ticket script. We’ve combined all of this into one tidy script, ready for use.
Features of this script:
Simple Template with Variables at the top for easy adoption. Simply change the variables for the script functions you want, and add the script code to the content box.
Filesystem Standardization. This Script creates the following directories on the asset for easy organization and reference:
- C:\ProgramData\yoursubdomain\Apps
- C:\ProgramData\yoursubdomain\Data
- C:\ProgramData\yoursubdomain\Installers
- C:\ProgramData\yoursubdomain\Logs
This allows you to set the paths of your downloaded files and output files for your scripts to be in a referenceable location. We run a monthly maintenance script on our log directory to only keep 30 days of logs. You can specify if you want the folder to be Title Case or UPPERCASE.
Store Logs Locally. You can select Local Logging for the script to output a timestamped log to the log directory. This is useful for future reference and troubleshooting. Not recommended if any sensitive data is outputted to clear text.
Script Execution Timer. Each script runs a timer that measures the amount of time the script takes to run. If applied to a ticket, this number is rounded to the nearest minute (it seems Syncro doesn’t allow tenths of a minute in the variable for duration. Can this be fixed please!?!).
Log Activity Notification. The Script outputs the Script Name and the Execution Time to the Log Activity
Random Start Time. Sometimes when we are ingesting a lot of endpoint data, especially with uploads to the asset, we hit Syncro’s wall and get the dreaded “too many requests”. We added this ability to spread out the initial start of scheduled scripts to mitigate this for larger sites.
Monthly Maintenance Ticket. Not going to lie, I hesitated sharing this as I think it’s an advantage, but at the end of the day, MSPs and IT personnel can be silos or partners. I’d like for us to always be a resource to those in the field. This feature creates a ticket at the beginning of each month, then any script with this variable enabled will clock time against this ticket. It auto-resolves it after the activity, so check your settings on ticket notifications, or this will go bad for you.
This script creates a ticket if one doesn’t exist. If one exists, it checks to see if it was created in the same month as when the script is being run. If it does not, it deletes the local marker and creates a new Maintenance Ticket.
Create Standalone Ticket. You can also have the script create a standalone ticket, as a response to an RMM Alert.
Billable Time for Script. You can select whether the time on this script is billable.
Manual Override for Activity Duration Want to charge a set amount of minutes for a script? Enter it into the override and all timer reports will match your custom time.
Auto-close RMM Alerts. Enabling this allows the script to close the RMM alert for the category you define for the asset.
Set your TechID for Tickets and Activity. Just a note, we use the userID instead of the email, it’s cleaner. The script instructs how to find yours.
Easier Variables in Scripts. Because we define so many variables, it makes it easy to reference in your script commands. $comp is the computername, $MSPAppsDir is the App directory in the folder structure. This makes adapting and referencing your scripts easy!
Easy to Read Output. I’ve done extra work to the time output and other readable text to make it very easy to understand.
That’s it! Please let me know your thoughts and feedback!