Functions
Scripts
2 files
-
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
370 downloads
0 comments
Updated
-
Perform Computer Restart and Related Scripts
This bundle contains the three following scripts:
FUNCTION - Check For Pending Reboot Checks to determine if a Reboot is needed. Sets "@RebootPending@=1" if a restart is required. "@RebootReason@" will contain the reasons a reboot was required, if any were found. If @RebootReason@ includes "!", the reboot is required. Process PendingFileRenameOperations This script will attempt to process pending file operations that would otherwise require a restart to complete. This may allow a reboot to be avoided. Perform Computer Restart* This script will execute a restart and sleep until the computer has restarted successfully. The script will wait 30 minutes before exiting with an error. Variable "@RebootPending@" used to return Reboot Status.
@RebootPending@ = 0 if reboot successful
@RebootPending@ = 255 if reboot failed
527 downloads
0 comments
Updated