Remote PowerShell / Bash Script Execution
PowerShell script can be executed:
With enabled RMM Service management mode and 2FA, you can run PowerShell scripts remotely from Management Console on computers with RMM Agent installed.
As of RMM Agent 1.6, the following script execution features are supported:
- Exit codes
- Script errors displayed
- Copy and paste
- Script interruption
RMM Agent script execution has some limitations:
- PowerShell version 5.0 or later is recommended. PowerShell version 4.5 can be used, but with restrictions:
- Once a command or script are executed, results of the previous command/script become not available
- Interactive PowerShell scripts are not supported
- Two-factor authentication must be enabled in your account
Run PowerShell Scripts on Remote Computer
To use a PowerShell console or to upload a PowerShell script to execute on a remote computer, proceed as follows:
- Open the Management Console.
- On Computers select Remote Management if you use legacy main menu, or open RMM > Computers page in the new main menu.
- In the computer list, find the target computer, then in the RMM column click the diagram icon.
- As the computer info is loaded, switch to the PowerShell tab.
- Select required option from the available ones:
- Execute PowerShell script from library. You can select one of predefined or added by you scripts from RMM Script Library
- Execute PowerShell script from file. You can execute PowerShell or Bash script on selected remote computer. Enter the command or click + to upload the PowerShell script to the remote computer.
- Open PowerShell Terminal. Select this option to open PowerShell Terminal for the remote computer.
- Once the script is selected, created, or uploaded, click Execute.
- Confirm with 2FA.
- Wait while the script execution is complete to retrieve the result.
Note that PowerShell scripts are run by the 'System' account
Run PowerShell Scripts on Multiple Computers
You can run PowerShell scripts remotely on multiple computers with the RMM Agent installed.
To run PowerShell scripts on multiple computers from a file or from script library, proceed as follows:
- Open the Management Console.
- On Computers select Remote Management if you use legacy main menu, or open RMM > Computers page in the new main menu.
- Click Group Actions and select New RMM Group Action Task. RMM Group Action wizard starts.
- Select the PowerShell Script group action. Click Next.
5. Select computers to execute the script
Select a scope to apply the group action. You can apply group action to all your companies, to specific companies, or to specific computers. You can exclude specified computers from the group action.
Consider, group actions apply only to computers with the RMM Agent installed and Monitoring enabled. To apply these actions to other computers, install RMM Agent instances onto these computers first. You can select computers that are offline at the moment of selection. The action, in this case, will be applied as these computers come online. Click Apply to save your selection.
Click Next.
- Select PowerShell script to execute:
- You can select cript execution from the file
- You can select script execution from the script library
Once the script is selected, click Next.
- Specify the schedule for the script execution. If you plan to run the execution manually, select the No schedule (run manually) option.
Click Next.
Note that if you select the 'No schedule' option, the started group action can be immediately applied to computers that are offline at the moment of the group task creation as they come online. Check whether the the Run missed scheduled tasks immediately when computer starts up option is selected to perform it.
If required, set the schedule for the group action execution. You can set the following schedule options:
- Run once
- Specific date (once, daily, or monthly). You can create a requrring schedule. The recurring schedule can be used for a task that takes place on a regular basis (e.g., every Monday and Wednesday from October through December on specific weekday and time).
When you specify the time for the group action execution, remember that the system time of the instance the RMM Agent is installed will be used
Note that PowerShell scripts are run by the 'System' account
Once you complete the new group action task configuring, click Create. You will be promplted to confirm the task execution.
Confirm the group action according to selected 2FA verification method.
If you selected the Run Once option, you will be provided with the report of the group task execution in real-time.
Click on the specific computer to view the detailed information on the group task execution.
Manage Group Action Tasks and View Results
Classic User Experience
With new main menu click RMM > Group Action Tasks
To view the group task details, click the task name in the Task column.
To delete the task, click the trash bin icon to the right of the task to delete, then confirm the deletion.
Classic User Experience
- Open the Management Console.
- With legacy main menu in the Computers menu, select Remote Management.
- To the upper right, click RMM Group Actions.
- Select Group Action Tasks.
To view the group task details, click the task name in the Task column.
To delete the task, click the trash bin icon to the right of the task to delete, then confirm the deletion.