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.

Prerequisites

  1. Create a Windows Device Profile
  2. Enroll a Windows 10 device
  3. Windows 10 version 1809 and above, with Windows Pro, Business, Enterprise, Education editions.
  4. Scalefusion MDM agent is installed on the enrolled Windows device
  5. Make sure that you have required storage in Enterprise Store.
  6. Enterprise App package and the following details from the developer,
    1. Powershell script (.ps1) file
    2. File size should be less than 1GB

Steps

Uploading and Installing a Powershell script

Follow the steps below to upload and install a Powershell script,

  1. Sign In to Scalefusion Dashboard. Navigate to Enterprise > My Apps > Enterprise Store
  2. Click on Upload New App > Upload Windows App
  3. Choose PowerShell(PS1) to upload ps1 file that will execute the script.
  4. Selecting the PowerShell would start the Upload Windows Powershell Scripts wizard. Follow the steps below to upload the file.
    1. Enter PowerShell Script Name: Used to identify in Device Profiles
    2. Upload Powershell Scripts File: Select how you want to upload the script file,
      1. Upload Local File: Use this option if you have the ps1 file available locally.
      2. 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.
    3. Execution Mode: Select the mode in which the script should be executed at the time of upload, from the following:
      1. 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.
      2. 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.
    4. 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.
    5. Click Save
  5. 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.

On Device

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,

  1. Navigate to Enterprise > My Apps > Enterprise Store
  2. Click on the PowerShell script that you uploaded earlier to see the script information wizard, Click on Uninstall
  3. Select the Device Profiles where you want to uninstall the application from and click on UnInstall
  4. 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,

  1. In the script information wizard, Click on Delete button
  2. You will get a confirmation box. Click OK

The script file will get deleted from Enterprise Store on Scalefusion dashboard.


How did we do?


Powered by HelpDocs (opens in a new tab)