How to Run PowerShell Array Parameters in an Intune Win32 App
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.

- 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.
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.
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.
Navigate to the Microsoft Endpoint Manager admin center, go to Apps > Windows, select your Win32 app, and click Edit next to the Program settings.
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"
Click Review + save to apply the new configuration. Monitor the deployment status on the target devices through the Intune dashboard.

Troubleshoot Detection Rules and Consult Microsoft Community
If the script executes but Intune still reports a failure, the issue may lie with the application's detection rules or deeper Intune configuration.
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. Download the Installer: Visit the official WPS Office website to download the free installation package.
- 2. Deploy Across Your Organization: Package the lightweight installer using the Microsoft Win32 Content Prep Tool for easy Intune deployment.
- 3. Enjoy Seamless Compatibility: Open, edit, and save your existing Microsoft Office documents effortlessly.

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.




