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 devices.
This document describes how PowerShell scripts can be uploaded and deployed on managed Windows devices.
Prerequisites
- Create a Windows Device Profile
- Enroll a Windows 10 or above device with Scalefusion
- Supported OS Configurations:
- Windows 10 version 1809 and above, with Windows Pro, Business, Enterprise, Education, Home editions.
- Windows 7 and 8.1Windows OS 7 and 8.1 and Windows Home (10 & 11) devices should be enrolled with Scalefusion MDM agent
- Scalefusion MDM agent's latest version is installed on the enrolled Windows device.
- Make sure that you have required storage in Enterprise Store. To know more about space allocation, please visit here.
- Enterprise App package and the following details from the developer,
- Powershell script (.ps1) file
- File size should be less than 1GB
Step 1: Uploading and Installing a Powershell script
Follow the steps below to upload and install a Powershell script,
- Sign In to Scalefusion Dashboard. Navigate to Application Management > Enterprise Store
- Click on Upload New App > Upload Windows App
(1).png)
- Choose PowerShell(PS1) to upload ps1 file that will execute the script.
(1).png)
- 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.

Step 2: Configure Script Settings and Custom Properties
Description: Briefly describe what this script does and when it should be used. The description can be up to 512 characters.
Execution Level: Select one from the following:
Device: The script will be executed for all existing users on the device
User: The script will be executed for the enrolled user or all users depending upon the execution context you select in the next drop-down.
Execution Context: Select one from the following:
Enrolled User (selected by default): Script will be executed only for enrolled user
All Users: Script will be executed for all the users on device
Execution Schedule: Configure a schedule when you want the script to be executed.
Run Once on Publish: Script will run as soon as you publish it from Dashboard
Run At Every Login: Script will run every time a user logs in to the device
Run on Schedule: You can select on which days the script should be executed.
Select Day: Select day(s) from Monday to Sunday.
Configure Time(s): You can set a time for executing the script and can add multiple time periods.
Add to Self-Service: Enable this to let users execute this script on-demand from the catalog
Configure Script Parameters
Inserted into Script: These are properties used as inputs inside the script. Each property shows:
Available: Property exists
Missing: Property does not exist
Updated by Script: These are properties updated by the script output. For each property, you can:
Bind or unbind it from the script (from Actions)
Choose whether to reset the value to
Nullif no value is foundSee if it’s already bound to another script (in Status)
A custom property can be bound to one script per platform.
Restrictions on Updating Custom Properties
If a custom property is linked to a script:
It cannot be edited from:
Device details
User details
Bulk upload
Developer APIs
You must remove the script binding first.
- Click Save

- Once you click on SAVE, Scalefusion will process the script, and if the processing succeeds then the following dialog will be shown. Configure the following:
- Configure Installation Mode:
- Install Immediately: This will install the app immediately on the device
- Add to Catalog:This will make the script file available inside Self-Service app on the device from where user can install it later.The selected Installation Mode overrides the Publish action chosen during script file upload.
- Select the Device Groups /Device Profiles / Devices where you want to publish the script and click Publish.

- Configure Installation Mode:
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. For example, in the above step, we have uploaded a script to Enable Windows Update. After publishing, on the enrolled device, open the 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 Application Management > 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 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
- In the script information wizard, Click on the Delete button

- You will get a confirmation box. Click OK

The script file will get deleted from Enterprise Store on the Scalefusion dashboard.
Dynamic Scripts
The PowerShell scripts are static in nature that is the same script gets executed on all devices, however, in some cases, the admin may want to pass some dynamic values based on the device or user of the device where the script is executing. Scalefusion now extends the support of Custom Fields to allow for dynamic substitution using our agent. For example,

To know more about the Custom Fields feature and how to use it please refer to our guide here.
Static Input Parameters for Scripts
You can define static input parameters for scripts and configure their values directly from the Dashboard. This eliminates the need to hardcode common values in scripts or maintain separate custom properties for individual devices. Using script-level parameters, administrators can provide values once at the script level and reuse them across devices where the script is deployed.
How to Configure Script Input Parameters
Step 1: Define Parameters in the Script
While creating or editing your script, insert parameters using the following syntax:
%$script.parameterName%
Here:
%is the delimiter used to identify a parameter.$script.identifies the parameter as a script-level input.parameterNameis the name assigned to the parameter.
For example:
echo "Server Name: %$script.serverName%" echo "Environment: %$script.environment%"You can define multiple parameters within a script.
Step 2: Configure Parameter Values in the Dashboard
During script configuration, navigate to the Configure Script Parameters section.
Open the Static Input Parameters tab. Scalefusion automatically detects the script-level parameters defined in your uploaded script.
Enter a value for each detected parameter.
Note:
Each detected parameter is displayed with its corresponding name and a text field to enter its value.
Parameter values must contain at least 1 and a maximum of 512 characters.
All detected parameters must have a value before you can save the script.

Step 3: Save and Publish the Script
Once all parameter values have been provided, save the script and publish it to the required devices. Scalefusion uses the configured values to substitute the corresponding script-level parameters during script execution.
Once a script is saved,
Its input parameter values cannot be modified by any administrator, including the script uploader and the Account Owner. To use different parameter values, you must upload the script again and configure the required values.
For security, input parameter values are masked by default, displaying only the first character and the last two characters. An eye icon is provided next to each parameter value, allowing the complete value to be viewed when clicked. However, the eye icon is available only to the administrator who uploaded the script. All other administrators will see the parameter values in masked form, without the option to reveal them.
Viewing Configured Parameters
After saving the script, you can view its configured parameters in the script information panel that opens on the right, under the Linked Parameters & Properties tab.
The Static Input Parameters table displays:
Parameter Name: The name of the parameter detected in the script.
Value: The configured parameter value. For security, values are masked, with only the first character and last two characters visible. Values containing three or fewer characters are completely masked.

Known Behaviors
- Powershell script will not execute at User level if devices are enrolled via Modern Management and are in Single App Mode.
- For devices on Multi-App Kiosk mode enrolled via Modern Management, at User level, the powershell scripts will execute only if user is logged in as admin on the device.
