Submit a request

Nerdio Help Center

Overview of Scripted Actions


Applies to: Nerdio Manager for MSP (NMM) v1.2.0+


Overview

Scripted Actions are a library of PowerShell scripts that can be run in either Azure or AVD Virtual Machines as another step for various tasks performed by Nerdio Manager for MSP.

There are two types of Scripted actions: Azure Runbooks and Windows Scripts. Each differ by where they are run:

scripted_action__types.png

Getting Started

Scripted Actions are available at customer account level. First login to NMM, then login to the customer account and finally select Scripted Actions from the main menu.

Create a Scripted Action

Click "Add Scripted Action" button located at the bottom right of the Scripted Action Page.

The following Fields will be presented:

Name: The name displayed when selecting from the list of available scripted actions.

Description: Description for use within NMM. This only appears on the Scripted Actions page.

Tags: Used for searching and organization

Script Execution Mode: This will dictate how NMM will act when passing the scripted action(s) to the VM. NMM uses the "Custom Script" Extension to ultimately execute the PowerShell commands (read more here.) The extension needs to be installed and removed every time it is used, and will add to the total time to execute for each time it does. Some PowerShell scripts can be combined together and passed with a single run if they do not interfere with each other, saving time.

  • Combined Marks the scripted action as one that can be combined safely with other scripted action. An example would be a scripts that adds a registry value.
  • Individual Scripts that should be run on their own. An example is a long script with commonly used variable names or require a fresh PowerShell session.
  • Individual with Restart Similar to Individual option, but will tell NMM to restart the VM after execution. These are generally used when installing software or altering windows in a manner that requires a restart to apply changes. (Windows Scripts Only)
  • Script: The PowerShell code that will be executed. You can pass variables into this code that Nerdio will replace dynamically depending on where it is run. Hover over the info icon to see more details.

Choose the settings that work best for your script, and input PowerShell code to be executed in the Script section

Nerdio TipIt is recommended to develop code using an IDE such as VSCode or ISE. Then test the PowerShell code on a dedicated "development" session host/azure VM.
 

 

Use a Scripted Action

Scripted Actions can be used as part of various tasks such as:

VM Provisioning - Executed during the provisioning or re-imaging of Session Host VMs. Whenever a session host is created, either from scratch or during re-imaging (which is essentially re-building the VM), the scripted action will be preformed as a final step.

To apply custom scripts for these tasks, navigate to the Host Pools screen, click the Action menu and select Properties -> VM Deployment.

Run Command - Manually run a command against a host pool. Useful if you simply need to alter all the session hosts without fully re-imaging them. For example, a script to change a registry key.

This is done by going to Host Pools screen, click the Action menu and select Hosts -> Run command.

Default Nerdio Scripts

Every Nerdio installation will come with default scripted actions. These are commonly used scripts and examples that you can use or reference for your own scripts. Default scripts will have the "Nerdio" tag. You can not edit the default scripts. You must clone them in order to create an editable copy.

 

Default Windows Scripts

Name Use Case Recommended Target Requires Customization*
Install MS Teams Convenient script to save time manually uninstalling and reinstalling teams. Also enables AVD Mode Image VMs (preferred), Session Hosts No
Install MS 365 Office Apps Convenient script to save time manually updating office apps Image VMs Yes - If the default list of apps installed is not desired
Virtual Desktop Optimization Optimize session hosts for better performance. Commonly used for Remote App Session hosts. Session Hosts Yes - By default many apps are removed, such as calculator. If this is undesired, edit them out of the script.
Install Zoom VDI Client Installs Zoom (VDI Version) Image VMs No
Enable RDP Shortpath Enables RDP Shortpath Image VMs or Session Hosts No
Enable AVD Screen Capture Protection Enables screen capture Protection. Also an example of how to use PowerShell to edit registry via scripted actions. Image VMs or Session Hosts No
Grant user local admin rights Adds user who is assigned to the personal desktop VM to the local admin group Session Hosts No
Update Windows Runs Windows 10 Updates Image VMs No

 

Default Azure Runbooks

Name Purpose Requires Customization*
Assign Public IP to VM Allows VM to have a public IP Yes - If Static IPs are required or naming scheme is undesired
Enable Antimalware Extension Adds anti-malware extension Yes - If custom exclusions or scan settings times are needed
Enable VM OS disk Encryption Encrypts Disk with Keyvault Yes - If using an existing key vault

*This script is intended to be cloned and edited to suit your needs. It may run fine without alteration, but care should be taken to ensure that the default behavior is desired.

Track your Scripted Actions

For tracking down failures due to scripted actions, important clues for the root cause can be found in the desktop images task logs. To view logs for scripted actions, log in to your NMM account and navigate to Desktop Images from the main menu. Locate the desktop image you want to work on. From the action menu click Run script:

Desktop_images_run_scripts.png

On the Run script pop-up, select the Windows script and/or Azure runbooks from the corresponding drop-downs. Select other parameters on the screen and click OK  button:

Run_script_on_desktop_image_popup.png

On Desktop Images screen, scroll down to Desktop Images Tasks section and click Details option:

Desktop_images_tasks_details.png

In case of Azure runbooks, NMM maintains the log output under Job Details section as shown below:Job_details_azure_runbooks_NC.png

While in case of Windows scripted actions, you must use Write-Host command to generate the log output. You can then download the same log output with the Download Custom Powershell Scripts logs button as shown below:

Job_details_runbooks_scripted_actions1.png

NMM portal will initiate the process to download logs from Azure. This process can take a few minutes:

Download_Azure_SA_logs.png

Click Download Custom Powershell Scripts logs button to view the logs downloaded from Azure in XML format:

Logs_XML_file.png

Custom Nerdio Scripts

NMM allows partners to integrate various external applications on their AVD host pools using Windows scripts:

Scripted Action for Huntress

NMM allows you to configure and run a scripted action to install Huntress application on AVD host pools.

To find whether the Huntress script is available for execution, navigate to Scripted Actions>Windows scripts and search for Huntress agent:

mceclip0.png

If you don't find the Huntress script, refresh your NMM repository. Refer this for more details.

To configure Huntress scripted action, navigate to Settings>Integrations and add the following secure variables first:

Huntress.PNG

 

Once secure variables are configured, navigate to AVD> Host Pools. Select a host pool where you wish to install the scripted action and select "Run script" as shown below:

Runscript.PNG

Select "Huntress" script from the drop-down and click "OK":

Select_huntress.PNG

You can monitor the status of script execution under "Host Pool tasks" section. Once the script executes successfully, log into the session host and check whether the Huntress script is installed under C:\Program Files\Huntress folder.

 

Scripted Action for Kaseya

NMM allows you to configure and run a scripted action to install/uninstall Kaseya application on AVD host pools. To find whether the Kaseya script is available for execution, navigate to Scripted Actions>Windows scripts and search for Kaseya install and uninstall agent as shown below:

mceclip1.png

If you don't find the Kaseya scripts, refresh your NMM repository. Refer this for more details.

To configure Kaseya scripted action, navigate to Settings>Integrations and add the following secure variables first:

Kaseya.PNG

 

Once secure variables are configured, navigate to AVD> Host Pools. Select a host pool where you wish to install the scripted action and select "Run script" as shown below:

Runscript.PNG

 

Select "Install Kaseya" script from the drop-down and click "OK":

select_install_kaseya.PNG

You can monitor the status of script execution under "Host Pool tasks" section. Once the script executes successfully, log into the session host and check whether the Kaseya agent is installed under C:\Program Files (x86)\Kaseya folder.

After you install Kaseya agent, you can execute uninstall Kaseya script as well. Select the same host pool where you had run the Kaseya scripted action and select "Run script" as shown below:

Runscript.PNG

 

Select "Uninstall Kaseya" script from the drop-down and click "OK":

select_uninstall_kaseya.PNG

You can monitor the status of script execution under "Host Pool tasks" section. Once the script executes successfully, log into the session host and check whether C:\Program Files (x86)\Kaseya folder is deleted.

 

Scripted Action for ConnectWise

NMM allows you to configure and run a scripted action to install RMM application on AVD host pools. To find whether the Connectwise script is available for execution, navigate to Scripted Actions>Windows scripts and search for Connectwise agent:

mceclip2.png

If you don't find the Connectwise script, refresh your NMM repository. Refer this for more details. To configure Connectwise scripted action, navigate to Settings>Integrations and add the following secure variables first:

Connectwise.PNG

Once secure variables are configured, navigate to AVD> Host Pools. Select a host pool where you wish to install the scripted action and select "Run script" as shown below:

Runscript.PNG

 

Select "Connectwise" script from the drop-down and click "OK":

Select_connectwise.PNG

 

You can monitor the status of script execution under "Host Pool tasks" section. Once the script executes successfully, log into the session host and check whether the Connectwise agent is installed under C:\Windows\LTSvc folder.

After you install Connectwise agent, you can execute uninstall Connectwise script as well. Select the same host pool where you had run the Connectwise scripted action and select "Run script" as shown below:

Runscript.PNG

 

Select "Uninstall Connectwise " script from the drop-down and click "OK":

mceclip0.png

Note: No secure variables are needed to execute the uninstall Connectwise agent script.

You can monitor the status of script execution under "Host Pool tasks" section. Once the script executes successfully, log into the session host and check whether C:\Windows\LTSvc folder is removed.

Was this article helpful?
0 out of 0 found this helpful
Important Notification for NFA Partners Only
  • Microsoft is sunsetting Azure Classic (not Azure Virtual Desktop (AVD)) - Microsoft Article
  • NFA sunset occurs February 20th, 2023
  • NFA will be fully supported until the official sunset - nfa.support@getnerdio.com

Comments

Please sign in to leave a comment.