Others

How to Run PowerShell Array Parameters in an Intune Win32 App

Chanuka GeekiyanageChanuka Geekiyanage Oct 26, 2026 868 views

Question details

The user needs to properly execute a PowerShell script containing array parameters when it is packaged and deployed as a Microsoft Intune Win32 application.

How to Run PowerShell Array Parameters in an Intune Win32 App
Product
Microsoft Intune
Device & OS
not provided
Scenario
Deploying a Win32 app via Microsoft Intune using a PowerShell script that requires array parameters to be passed during installation.
Observed behavior
The PowerShell script successfully accepts array parameters when executed locally, but it fails to run or parse the parameters correctly when packaged and executed as an Intune Win32 app.
Before you start

Ensure you have the necessary Intune administrator permissions and verify that your PowerShell script is thoroughly tested locally using the exact command line before packaging it into an .intunewin file.

Solution 1Recommended

Use the -File Parameter in the Intune Install Command

Switching the Intune installation command to use the -File parameter allows PowerShell to properly parse the array parameters passed to the script.

When using the -Command parameter, PowerShell parses the arguments as a string command block, which can cause array parameters to break or be misinterpreted during an Intune deployment. Using the -File parameter explicitly tells PowerShell to treat the subsequent arguments as script parameters.

1
Access your Intune App deployment settings

Navigate to the Microsoft Endpoint Manager admin center, go to Apps > Windows, select your Win32 app, and click Edit next to the Program settings.

2
Update the Install command

Change your execution command to use -File instead of -Command. Structure it as follows: powershell.exe -ExecutionPolicy Bypass -File ".\install.ps1" -i -name "myApp" -variant "2022"

3
Save and monitor deployment

Click Review + save to apply the new configuration. Monitor the deployment status on the target devices through the Intune dashboard.

Use the -File Parameter in the Intune Install Command
Installation Status Warning: Intune might initially report an incorrect installation status after making this change. If the app installs correctly but shows as failed, you will need to review your application detection rules.
Free Microsoft Office alternative

Looking for a Lightweight Office Suite for Your Enterprise Deployment?

While you troubleshoot your Intune application deployments, consider WPS Office as an excellent alternative for your organization's document needs. It offers exceptional compatibility with Microsoft Office formats and features a lightweight installer that is highly optimized for enterprise software deployment.

  1. 1. Download the Installer: Visit the official WPS Office website to download the free installation package.
  2. 2. Deploy Across Your Organization: Package the lightweight installer using the Microsoft Win32 Content Prep Tool for easy Intune deployment.
  3. 3. Enjoy Seamless Compatibility: Open, edit, and save your existing Microsoft Office documents effortlessly.
Fully compatible with Microsoft Word, Excel, and PowerPoint formats.Lightweight installation package suitable for fast enterprise deployment via Intune or SCCM.Familiar user interface ensuring seamless employee migration without retraining.Cost-effective, robust alternative to Microsoft Office for business environments.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my PowerShell script work locally but fail in Intune?

Intune typically executes deployment scripts in the SYSTEM context rather than the user context, and parses command-line parameters differently. Using the -Command switch can cause array parameters and quotes to be misinterpreted, whereas -File treats the arguments cleanly as script parameters.

How do I package my PowerShell script into a Win32 app?

You need to use the Microsoft Win32 Content Prep Tool to package your .ps1 script and any associated deployment files into an .intunewin file. This file can then be uploaded to the Microsoft Endpoint Manager admin center as a Win32 app.

What should I do if Intune shows an incorrect installation status after running the script?

First, verify that the script actually executed successfully on the endpoint by checking local deployment logs (e.g., IntuneManagementExtension.log). If the installation was successful, ensure that the detection rules configured in Intune exactly match the changes made by the script, such as a specific file creation or registry key addition.