Deploy PowerShell scripts using Scalefusion
Windows PowerShell is a powerful tool for automating tasks and simplifying configuration and can be used to automate almost any task in the Windows ecosystem. With a carefully designed script, you can automate the process of adding network drives, installing apps, updating security software, and granting a new user access to shared files. It is no wonder that it has become a popular tool among system admins and experienced Windows users.
Moving a step forward towards enhancing Windows Device Management, Scalefusion MDM enables uploading PowerShell script files and then executing those scripts remotely on Scalefusion managed Windows 10 devices.
This document describes how PowerShell scripts can be uploaded and deployed on managed Windows devices.
- Create a Windows Device Profile
- Enroll a Windows 10 device
- Windows 10 version 1809 and above, with Windows Pro, Business, Enterprise, Education editions.
- Scalefusion MDM agent is installed on the enrolled Windows device
- Make sure that you have required storage in Enterprise Store.
- Enterprise App package and the following details from the developer,
- Powershell script (.ps1) file
- File size should be less than 1GB
Uploading and Installing a Powershell script
Follow the steps below to upload and install a Powershell script,
- Sign In to Scalefusion Dashboard. Navigate to Enterprise > My Apps > Enterprise Store
- Click on Upload New App > Upload Windows App
- Choose PowerShell(PS1) to upload ps1 file that will execute the script.
- Selecting the PowerShell would start the Upload Windows Powershell Scripts wizard. Follow the steps below to upload the file.
- Enter PowerShell Script Name: Used to identify in Device Profiles
- Upload Powershell Scripts File: Select how you want to upload the script file,
- Upload Local File: Use this option if you have the ps1 file available locally.
- PS Script file URL: Use this option if you have hosted/uploaded the file on your servers and have a link that is accessible publicly. Provide the URL to the externally hosted file. This URL should be publicly available.
- Execution Mode: Select the mode in which the script should be executed at the time of upload, from the following:
- Run As Background: Choose this for the scripts which do not require UI operations and where the commands run in background without occupying console. As for example, running script for Adding User, Enable/Disable USB, Enable/Disable Windows Update etc. select this execution mode.
- Run As Foreground: The scripts which are UI based occupying console or screen like launching notepad, changing Wallpaper, and the like, need to be run in foreground. Hence, for running such scripts select this execution mode.
- Upload Logo: Select and upload a logo that you want to keep for the script file. If you do not upload any logo, the default logo appears.
- Click Save
- Once you click on SAVE, Scalefusion will process the script and if the processing succeeds then the following dialog will be shown. Here you can select the Device Profiles where you want to publish the script and click Publish
Checking Execution Status
After publishing, you can check the status whether the powershell script pushed from enterprise store has been executed or not, by using the View Status option,
A script that is well executed on the device, shows the status as Executed and if not then the status shows as Pending or Execution Failed.
The powershell script executed will reflect on the device. As for example, in the above step we have uploaded a script to Enable Windows Update. After publishing, on the enrolled device, open Services app.
You will find Windows Update in Automatic Trigger start mode enabling the detection, download and installation of updates for Windows and other programs.
If you wish to disable Windows Update on the device, there is a Powershell script for the same. Simply upload the script file to disable Windows update following same steps and publish it. Once executed it will reflect on the managed device under Services app and disable the detection, download and installation of updates for Windows and other programs.
Uninstalling PowerShell Script
PowerShell scripts cannot be uninstalled from the devices remotely. However you can block the execution of the scripts on devices that are yet to enroll. Follow the steps below to Uninstall a previously deployed script,
- Navigate to Enterprise > My Apps > Enterprise Store
- Click on the PowerShell script that you uploaded earlier to see the script information wizard, Click on Uninstall
- Select the Device Profiles where you want to uninstall the application from and click on UnInstall
- Once this step is done, the script will no longer be force installed and executed on the devices. However the users need to Uninstall the application on the device.
Deleting PowerShell Script
A PowerShell script file can also be deleted. It deletes the script file from Enterprise Store on Scalefusion Dashboard. But it will be there on the device. To delete a script file,
- In the script information wizard, Click on Delete button
- You will get a confirmation box. Click OK
The script file will get deleted from Enterprise Store on Scalefusion dashboard.