These are the resources I keep coming back to for [[ConnectWise Automate]]. # Globals and Parameters Parameters can be created for the global variable that will prompt the user when running the script for a specific value (e.g., `Delay_Minutes`). Please note that defining variables here creates new variables and does not update current values. |Field|Description| |---|---| |Name|Enter name of the script. Use a friendly name to easily identify the script. The Name should only contain alphanumeric characters, hyphens, and underscores.| |Global Variables: Name|User-defined. Useful to avoid having to pass frequently used variables continuously throughout several functions. Global variables can be used in the scripts that they are created in and any other scripts that are called within that script.| |Global Variables: Value|The value of the global variable you created.| |Parameters|Use the Add button to add any desired parameters for the global variable. For example, you can add a parameter to delay all monitors to run by a specified number of minutes (e.g., Delay_Minutes). You can see an example parameter in the System Commands > LabTech Automation > Pause Internal Monitors script. When the script is scheduled, it will prompt the user for the value to enter in the parameter. Limited to five parameters.| |LabTech Defined Global Variables| | |disablerecursioncheck|To have a script call itself limitless times, create this global variable on the Globals and Parameters tab with any random value.| |TZCompDisabled|To disable timezone compensation, create this global variable on the Globals and Parameters tab with the value of ‘1’.| [Create a New Script in the Control Center - ConnectWise](https://docs.connectwise.com/ConnectWise_Automate_Documentation/070/240/050/020#Define_Globals_and_Parameters) # Script Credentials *Apparanty* 'Run as Local Agent' runs as SYSTEM.^[[ninjaspy123 comment on labtech - reddit](https://www.reddit.com/r/labtech/comments/5wp7ev/comment/debvuju/?utm_source=share&utm_medium=web2x&context=3)] Run as Admin uses the admin login defined for the [[ConnectWise Automate Location|location]]. ## Running as a logged in user [Running programs/scripts as a logged in user in a LabTech/Automate Script – Gavsto.com – Everything NinjaOne, MSP and Reporting](https://www.gavsto.com/running-programs-scripts-as-a-logged-in-user-in-a-labtech-automate-script/) [Gavsto-Public-Scripts/Running as a user in an Automate Script at master · gavsto/Gavsto-Public-Scripts · GitHub](https://github.com/gavsto/Gavsto-Public-Scripts/tree/master/Running%20as%20a%20user%20in%20an%20Automate%20Script) [Automating with PowerShell: Impersonating users while running as SYSTEM (cyberdrain.com)](https://www.cyberdrain.com/automating-with-powershell-impersonating-users-while-running-as-system/) # Debugging - Set Global Variable `ScriptEngineEnableLogger` to true. - Use the `Start-Transcript` [[PowerShell]] command in your script so you can see exactly what happens while running the script. # %tempdir% Directory In automate scripting sometimes you will see or use `%tempdir` as a path in a script. The directory is defined by the [[ConnectWise Automate Agent#Templates|agent template]] and can be seen in the [[ConnectWise Automate Agent#Effective Policy|effective policy]]. # %ltsvcdir% Directory