Jump to content

Contribution :GetFile Downloader Function Script

Recommended Posts

GetFile Downloader Function Script

The function Script "GetFile" is a simple way to always follow best practices for file downloads as well as enabling advanced functionality. A sample script showing how to use it is included, plus two Scriptlets to insert the script steps needed to use this in two clicks. Previously this script was known as GetLTFile.

At its minimum, you can use this by defining two variables (the source and destination for the download) and calling the script. The script will test if the file already exists and skip downloading automatically. It will verify the target folder exists before attempting to download, and create it if needed. If a download fails it will try again by default, and will automatically enable verbose logging after two failures from the same script. Compressed file contents are automatically extracted (.ZIP under Windows, OSX, Linux if unzip is installed. .TGZ under OSX, Linux). By defining additional variables you can require that the file meets Minimum or Maximum size limits or verify the MD5 Checksum is valid (all three options supported under Windows, OSX, and Linux). You can require the file to always be re-downloaded, specify the number of retries allowed, and can even support automatic failover by specifying multiple sources.

Supported download protocols are ones supported by the "File Download" function (LTShare\Transfer\*) and "File Download URL" function (HTTP, HTTPS for all agents plus UNC paths for Windows Agents). With the optional WINSCP binary, SFTP:// is also a supported protocol (Windows only).

To import the Scripts, select Tools -> Import -> XML Expansion. After import the scripts should appear in the root Scripts folder.
To import the Scriptlets, select Tools -> Import -> SQL File. The Scriptlets should be imported AFTER the scripts have already been added. For more instructions on Scriptlets see https://docs.connectwise.com/ConnectWise_Automate/ConnectWise_Automate_Documentation/070/240/050/020#Use_Scriptlets


Share this post

Link to post
Share on other sites

Sounds like a very usefull script with some extra features.

I am not able to install this script 

upon import is the cache reloads but it never shows up.

I tried changing the ID's remaming teh script nothing.

Any Ideas ?

Thanks Matthias

Share this post

Link to post
Share on other sites
On 3/28/2019 at 11:27 AM, Matthias said:

I am not able to install this script 
I tried changing the ID's renaming the script nothing.

Automation -> Scripts -> View Scripts. Select the root node and search for GetFile.

Did you find it?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now