Run installation and uninstall as a 32-bit process on 64-bit clients with PSADT

Hi,

Had some issues deploying Matlab Runtime 9.4 (2018a) to our clients. I initially deployed Matlab with the latest version of PSADT but the setup.exe failed within 1 second. Sometimes when I pressed the Retry button in Software Center it did install, but I do not want to bother my users with pressing Retry.

After many failed attempts with PSADT I tried to run the setup.exe directly from within the MECM deployment type filling the install program path with setup.exe -agreetolicense yes -mode silent parameters. That also did not work but it gave me an error log file in the c:\windows\ccmcache\z folder.

The error was:

There is insufficient memory for the Java Runtime Environment to continue.

Native memory allocation (malloc) failed to allocate 1048576 bytes for AllocateHeap

When searching for this error I found this: Why do I get a "java.lang.OutOfMemoryError" or "there is insufficient memory for the Java Runtime Environment ... - MATLAB Answers - MATLAB Central

The solution is to Run installation and uninstall program as a 32-bit process on 64-bit clients.

So I checked the “Run installation and uninstall program as a 32-bit process on 64-bit clients” and it worked.

Now I’m wondering if there is such an option for the PSADT. I’m guessing that when I check the Run installation and uninstall… checkbox, the Invoke-AppDeployToolkit.exe wil run as a 32-bit process, but will the setup.exe inside the Invoke-AppDeployToolkit.ps1 also run as a 32-bit process ?

The command with the PSADT I used was:

Start-ADTProcess -FilePath "$($adtSession.DirFiles)\bin\win64\setup.exe" -ArgumentList '-agreeToLicense yes -mode silent -outputFile C:\Windows\Logs\Software\MatLab_Runtime_R2018a-Install.log' -WaitForChildProcesses

but the Start-ADTProcess function does not have a parameter for running the .exe as a 32-bit process on 64-bit clients.

This may help:

"In addition, Invoke-AppDeployToolkit.exe supports the following parameters:"

Parameter Values Description
/Debug Launches the script in a visible window displaying live logging output on-screen.
/32 Launches the script using PowerShell x86. This is useful for compatibility with x86 libraries or components.
/Core Launches the script using PowerShell Core (pwsh.exe).
-File *.ps1 Specify a custom script file to run instead of the default Invoke-AppDeployToolkit.ps1.
*.ps1 Specify a custom script file to run instead of the default Invoke-AppDeployToolkit.ps1.

I'd suspect

Invoke-AppDeployToolkit.exe /32 -DeploymentType Install

and

Invoke-AppDeployToolkit.exe /32 -DeploymentType Uninstall

may achieve what you need

Thanks, will give it a try. :grinning_face:

Unfortunately the /32 parameter did not work.

<![LOG[[Initialization] :: PowerShell Process Path is [C:\WINDOWS\SysWOW64\WindowsPowerShell\v1.0\PowerShell.exe].]LOG]!><time="10:30:07.116+60" date="3-05-2026" component="Open-ADTSession" context="NT AUTHORITY\SYSTEM" type="1" thread="7828" file="C:\WINDOWS\ccmcache\l\PSAppDeployToolkit\PSAppDeployToolkit.psm1">

Powershell x86 is indeed launched, but the setup.exe inside the script stops within 1 second with error code 1.

<![LOG[[Install] :: Preparing to execute process [C:\WINDOWS\ccmcache\l\Files\bin\win64\setup.exe]...]LOG]!><time="10:30:38.123+60" date="3-05-2026" component="Start-ADTProcess" context="NT AUTHORITY\SYSTEM" type="1" thread="7828" file="C:\WINDOWS\ccmcache\l\PSAppDeployToolkit\PSAppDeployToolkit.psm1">
<![LOG[[Install] :: CreateNoWindow not specified, StdOut/StdErr streams will not be available.]LOG]!><time="10:30:38.129+60" date="3-05-2026" component="Start-ADTProcess" context="NT AUTHORITY\SYSTEM" type="1" thread="7828" file="C:\WINDOWS\ccmcache\l\PSAppDeployToolkit\PSAppDeployToolkit.psm1">
<![LOG[[Install] :: Working Directory is [C:\WINDOWS\ccmcache\l\Files\bin\win64].]LOG]!><time="10:30:38.131+60" date="3-05-2026" component="Start-ADTProcess" context="NT AUTHORITY\SYSTEM" type="1" thread="7828" file="C:\WINDOWS\ccmcache\l\PSAppDeployToolkit\PSAppDeployToolkit.psm1">
<![LOG[[Install] :: Executing ["C:\WINDOWS\ccmcache\l\Files\bin\win64\setup.exe" -agreeToLicense yes -mode silent -outputFile C:\Windows\Logs\Software_WAMS_MatLab_Runtime_R2018a-Install.log]...]LOG]!><time="10:30:38.133+60" date="3-05-2026" component="Start-ADTProcess" context="NT AUTHORITY\SYSTEM" type="1" thread="7828" file="C:\WINDOWS\ccmcache\l\PSAppDeployToolkit\PSAppDeployToolkit.psm1">
<![LOG[[Install] :: Executed ["C:\WINDOWS\ccmcache\l\Files\bin\win64\setup.exe" -agreeToLicense yes -mode silent -outputFile C:\Windows\Logs\Software\MatLab_Runtime_R2018a-Install.log], awaiting completion...]LOG]!><time="10:30:38.162+60" date="3-05-2026" component="Start-ADTProcess" context="NT AUTHORITY\SYSTEM" type="1" thread="7828" file="C:\WINDOWS\ccmcache\l\PSAppDeployToolkit\PSAppDeployToolkit.psm1">
<![LOG[[Install] :: Execution failed with exit code [1].]LOG]!><time="10:30:38.269+60" date="3-05-2026" component="Start-ADTProcess" context="NT AUTHORITY\SYSTEM" type="3" thread="7828" file="C:\WINDOWS\ccmcache\l\PSAppDeployToolkit\PSAppDeployToolkit.psm1">
<![LOG[[Install] :: StdOut Output from Execution: N/A]LOG]!><time="10:30:38.273+60" date="3-05-2026" component="Start-ADTProcess" context="NT AUTHORITY\SYSTEM" type="1" thread="7828" file="C:\WINDOWS\ccmcache\l\PSAppDeployToolkit\PSAppDeployToolkit.psm1">
<![LOG[[Install] :: StdErr Output from Execution: N/A]LOG]!><time="10:30:38.275+60" date="3-05-2026" component="Start-ADTProcess" context="NT AUTHORITY\SYSTEM" type="1" thread="7828" file="C:\WINDOWS\ccmcache\l\PSAppDeployToolkit\PSAppDeployToolkit.psm1">
<![LOG[[Install] :: Interleaved Output from Execution: N/A]LOG]!><time="10:30:38.276+60" date="3-05-2026" component="Start-ADTProcess" context="NT AUTHORITY\SYSTEM" type="1" thread="7828" file="C:\WINDOWS\ccmcache\l\PSAppDeployToolkit\PSAppDeployToolkit.psm1">
<![LOG[[Install] :: An unhandled error within [Invoke-AppDeployToolkit.ps1] has occurred.
Error Record:

Message               : Execution failed with exit code [1].

FullyQualifiedErrorId : ProcessExitCodeError,Start-ADTProcess
ScriptStackTrace      : at Start-ADTProcess, C:\WINDOWS\ccmcache\l\PSAppDeployToolkit\PSAppDeployToolkit.psm1: line 22554
at Install-ADTDeployment, C:\WINDOWS\ccmcache\l\Invoke-AppDeployToolkit.ps1: line 172
at , C:\WINDOWS\ccmcache\l\Invoke-AppDeployToolkit.ps1: line 356
at , : line 1

TargetObject          : Process     : System.Diagnostics.Process (setup)
LaunchInfo  : ProcessLaunchInfo { FilePath = C:\WINDOWS\ccmcache\l\Files\bin\win64\setup.exe, ArgumentList = System.Collections.ObjectModel.ReadOnlyCollection`1[System.String], WorkingDirectory = C:\WINDOWS\ccmcache\l\Files\bin\win64, RunAsActiveUser = , UseLinkedAdminToken = False, UseHighestAvailableToken = False, InheritEnvironmentVariables = False, ExpandEnvironmentVariables = False, DenyUserTermination = False, InheritHandles = False, UseUnelevatedToken = False, UseShellExecute = False, Verb = , CreateNoWindow = False, WaitForChildProcesses = True, KillChildProcessesWithParent = False, StreamEncoding = System.Text.SBCSCodePageEncoding, WindowStyle = , ProcessWindowStyle = , PriorityClass = , CancellationToken = , NoTerminateOnTimeout = False }
CommandLine : "C:\WINDOWS\ccmcache\l\Files\bin\win64\setup.exe" -agreeToLicense yes -mode silent -outputFile C:\Windows\Logs\Software\MatLab_Runtime_R2018a-Install.log
ExitCode    : 1
StdOut      : {}
StdErr      : {}
Interleaved : {}

PositionMessage       : At C:\WINDOWS\ccmcache\l\Invoke-AppDeployToolkit.ps1:172 char:5

Start-ADTProcess -FilePath "$($adtSession.DirFiles)\\bin\\win64\\set ...

\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~

]LOG]!><time="10:30:38.368+60" date="3-05-2026" component="Invoke-AppDeployToolkit.ps1" context="NT AUTHORITY\SYSTEM" type="3" thread="7828" file="C:\WINDOWS\ccmcache\l\Invoke-AppDeployToolkit.ps1">
<![LOG[[Finalization] :: [MatWorks_MatLabRuntime_9.4_EN_01] install completed in [31.3118907] seconds with exit code [1].]LOG]!><time="10:30:38.380+60" date="3-05-2026" component="Close-ADTSession" context="NT AUTHORITY\SYSTEM" type="3" thread="7828" file="C:\WINDOWS\ccmcache\l\PSAppDeployToolkit\PSAppDeployToolkit.psm1">
<![LOG[-------------------------------------------------------------------------------]LOG]!><time="10:30:38.382+60" date="3-05-2026" component="Close-ADTSession" context="NT AUTHORITY\SYSTEM" type="1" thread="7828" file="C:\WINDOWS\ccmcache\l\PSAppDeployToolkit\PSAppDeployToolkit.psm1">

Hi @MRE
Please could you do us a favour and edit your last post and wrap your log within the preformatted text (Use the </> button on the toolbar) - It makes it so much easier to read
alternatively put ``` on a line above and on a line below the log

We can then see where the log finishes and your comments start :grin:
Thank You

2 Likes

Hi, I was looking for an option to upload the log in .txt format, but there wasn’t.

I edited my post as per your suggestion, thanks.

I just switched back to deploying the Matlab application without the use of PSADT and checked the Run installation an uninstall as 32-bit process and it installed again without any issues.

Are there any other suggestions I can try within the PSADT to run the setup.exe as a 32bit process ?

Thanks, much easier to read

I'm interested what you have on these lines

Install-ADTDeployment, C:\WINDOWS\ccmcache\l\Invoke-AppDeployToolkit.ps1: line 172

and

C:\WINDOWS\ccmcache\l\Invoke-AppDeployToolkit.ps1: line 356

I'm not familiar with the application you are referring to, but I wonder if the .exe you are running is an MSI wrapper, I very much doubt it has succeeded after 1 second, but is an exit code of 1 from the app actually success?
Did the app install?
as you can pass -SuccessExitCodes 1,2 to the Start-ADTProcess command
as per example 1:

Also if it is an exe wrapper around an MSI, you might want the -WaitForMsiExec switch

and maybe it needs to wait for any Child processes that are spawned to complete
WaitForChildProcesses

As a long shot, I wonder if the path to the log file (in your 1st post) should be quoted, so the command line should look like this:

Start-ADTProcess -FilePath "$($adtSession.DirFiles)\bin\win64\setup.exe" -ArgumentList '-agreeToLicense yes -mode silent -outputFile "C:\Windows\Logs\Software\MatLab_Runtime_R2018a-Install.log"' -WaitForChildProcesses

I appreciate that my suggestions may not be the complete answer, but hopefully they'll point you towards a solution

Hi @Adrian_Scott

Thanks for all the suggestions. To answer your questions:

Line 172:

Start-ADTProcess -FilePath "$($adtSession.DirFiles)\bin\win64\setup.exe" -ArgumentList '-agreeToLicense yes -mode silent -outputFile C:\Windows\Logs\Software\MatLab_Runtime_R2018a-Install.log' -WaitForChildProcesses

To understand Matlab 9.4 (2018a): https://ssd.mathworks.com/supportfiles/downloads/R2018a/deployment_files/R2018a/installers/win64/MCR_R2018a_win64_installer.exe

Line 356:

& "$($adtSession.DeploymentType)-ADTDeployment"

The setup.exe is not a msi wrapper and after the setup.exe stops after barely one second, the application is not installed. Installation takes about 1 to 1.5 minutes to complete.

When you unzip Mathlab installer you get a bunch of folders together with a setup.exe. When launching this setup.exe from a commando prompt, it immediately ends and calls a second setup.exe. This can be seen when using taskmanager.

Inside the \bin\win64 folder there is also a setup.exe. From searching various forums I found out that this setup.exe works better than the one in the root of the folder.

Regarding the log path should be between quotes: I tested this and the setup.exe is very picky about this. Leaving it without quotes simply works.

One thing to mention is that the setup.exe in the root can be used with the argument -inputfile installer_input.txt.

The installer_input.txt looks like this:

agreeToLicense=yes
destinationFolder=C:\Program Files\MATLAB\MATLAB Runtime
mode=silent
outputFile=C:\Windows\Logs\Software\MatLab_Runtime_R2018a-Install.log

We use MECM 2503 and deploy this application to Dell workstations with 32GB of RAM.

:thinking:
The Mathworks site has a silent install guide here: https://uk.mathworks.com/help/install/ug/install-noninteractively-silent-installation.html - This may help

I have had a quick search on the PSADT discourse forum (here) and found these MATLAB related posts:

If any of the install commands these posts mention don't help you, you could send a direct message to each of these users to see how they achieved it in the end?

1 Like

Thanks again Adrian !!!

I’ve read the silent installer guides from Mathworks but forgot to search the PSADT forum for similar problems with Mathlab.

For now, the “Run installation and uninstall as a 32-bit process on 64-bit clients“ option on the Program tab of the MECM Deployment type worked. Hopefully in the future the PSADT will have a similar option. I have te feeling that the Invoke-AppDeployToolkit.exe /32 does not cover it all.

Maybe one of the devs can elaborate on this ?

1 Like

You can also try this Intune install command for 32 bit:

powershell.exe -file Invoke-AppDeployToolkit.ps1 -DeploymentType Install

1 Like