1. Home
  2. Knowledge Base
  3. SureMDM
  4. Windows Management
  5. How to Run PowerShell Scripts on Windows Devices Using SureMDM?

How to Run PowerShell Scripts on Windows Devices Using SureMDM?

PowerShell scripts simplify Windows device management by automating tasks like system monitoring, user management, and policy enforcement. SureMDM’s new multi-line PowerShell scripting enhances this by enabling seamless execution of complex commands while providing detailed results be it errors, outputs, or warnings. This makes remote management more efficient and transparent.

Lets understand how an administrator can easily organise and make use of the Multi-line Powershell scripting using SureMDM RunScript jobs.

Purpose:

The purpose of this article is to understand how to Run a Multi-line PowerShell Script on Windows Using SureMDM

Pre-Requisites:

1. A SureMDM account.
2. The PowerShell script you’d like to use.
3. A Windows device enrolled into SureMDM using SureMDM agent 6.02.0.

Steps to Run a PowerShell Script:

1. Using SureMDM’s Run Script job functionality, import the supported files or add a multi-liner scripts:

  • Navigate to Jobs.
  • Select Windows as the Operating System.
  • Select Run Script and enter a Job Name. 
  • With this runscript job, the Administrator will have an ability to import or paste in the whole script (multi-line) and execute it.
  • An example of the multi-line scripts looks like below:
  • You could also import script files like PowerShell scripts, VBS scripts, Batch scripts and scripts in text files.

NOTE:
The supported file formats are .txt, .ps1, .bat and .vbs

  • Select Save to save this Job.

2. Applying the run-script jobs and understanding the script execution results:

  • Navigate to the SureMDM Home page.
  • Select the desired device(s) or Group of devices.
  • Select the Apply button (or Group-Apply button) and apply the jobs that’ve been created.

Once the jobs are deployed, the administrator can monitor the execution results based on the job status. The system provides a brief status message, including output details, warnings, errors, or success confirmations.

Here are a few examples of how the results would appear based on the job execution:

Runscript Success message:

Runscript Warning Message:

Runscript Error Message:

If you have any questions or need help with our products, please don’t hesitate to contact our support team.

CONTACT US

Was this helpful?
YesNo
Updated on February 2025
Need Support?
Can't find the answer you're looking for?
Contact Support