How can we help? 👋

Scripts

Scripts are the less complex and extensive alternative to Software Library.

Scripts provide a simpler and less extensive alternative to the Templates. By using a script, you can avoid the need to manually input "create file" and "execute" commands, as the script will automatically execute them. Additionally, all the necessary fields for creating the file are already included in the script, saving you the time and effort of searching for and configuring them individually in the toolbox.

To create a script visit Automations - Scripts and click on the Create button in the menu. The scripts section also has two tabs: My Scripts, which includes only the scripts the logged in user created and the Script Library which has all scripts that are being inherited to the organisation. To make a script availabe in the Script Library for the whole organisation, click the checkbox for Inherit to managed organisation in the script creator. The script creator supports several languages, which you can determine by selecting a suitable one, like for example powershell, in the dropdown menu under Language in the script creator.

 
Notion image
Notion image
Notion image
 

Check via Errorlevel

Scripts also allow you to check certain things through errorlevel. For example, you can create a job, that send you an email, whenever something is wrong.

As an example, let’s look at the Block Windows 11 script from the script library, and send a message if the device is not on Windows 11 (so error code not 0).

First you have to create a script. If you use PowerShell as the script language, you have to use exits to determine the Errorlevel.

💡

Sidenote: If you plan on using a script from the script library, you first have to copy it to my scripts, by clicking the three dots in front of the intended script and selecting Copy to “My scripts”.

 
Notion image
 

In this example we have exit 0 when everything is okay and exit 1, when the device has any operatingsystem but Windows 10 installed.

After you have saved the script, you can create a job. First you have to let the script run, then you use an if clause and check for lastErrorLevel. To do that you have to drag run script under scripts from the toolbox and select the script, then drag if under Flow from the toolbox. If lets you choose a condition. One of the condition you can select is returnCode.

 
Notion image
 

Check if returnCode is the same as the failed exit, in this case, if it is 1.

 
Notion image
 

Then you can select what you want to do, if there is an undesired outcome. This is the automation for Blocking Windows 11:

 
Notion image
 
Did this answer your question?
😞
😐
🤩