What You Need to Get Started:
- A SureMDM account.
- The PowerShell commands you’d like to use, formatted as a .ps1 file.
- A Windows 10 device enrolled into SureMDM, with the on-device app (known as SureMDM Agent) installed.
Steps to Run a PowerShell Script:
1. Using SureMDM’s File Transfer job functionality, transfer the .ps1 file to your device
a. On the SureMDM central console, navigate to Jobs.
b. Select Windows as the Operating System.
c. Select File Transfer and enter a Job Name.
d. Click on Add, and in the File Path box, upload the .ps1 file (e.g. sample.ps1).
e. In the Device Path box, enter the destination path where the file should get delivered to (example: C:\User\Downloads\). Please make sure to copy this destination path.
f. Select OK to save this Job.
2. Using SureMDM’s Run Script job functionality, invoke the .ps1 file
a. Navigate to Jobs.
b. Select Windows as the Operating System.
c. Select Run Script and enter a Job Name.
d. In the text box, enter the following snippet:
powershell.exe -ExecutionPolicy Bypass -file "C:\Users\Downloads\sample.ps1"
e. Select Save to save this Job.
3. Applying the jobs from Steps 1 and 2 on to Windows 10 devices
a. Navigate to the SureMDM Home page.
b. Select the desired device(s) or Group of devices.
c. Select the Apply button (or Group-Apply button) and apply the jobs you created in the following order
i. First, the File Transfer job created in Step 1.
ii. Then, the Run Script job created in Step 2.