Hello,
Anyone from this conversation, people you please explain, why you have discarded Execute-Process function support for array of parameters? The parameter with name â-Parametersâ in source code defined as [String[]] array of strings, which should be used with supplied comma-delimited parameters, but not constructing something over-complicated like multiple times double quoted compound-escaped-parameter string, which is why I think there are issues with deployments, because you then need to address handling multiple doublequotes and interpretation by numerous powershell functions.
So, if using array-type capabilities, your command line would look like this:
# Single Line - Pass array of parameters to -Parameters, which expects input as [String[]] array of strings
[psobject]$ExecuteProcessResult = Execute-Process -Path "$dirSupportFiles\PsExec64.exe" -Parameters @('-accepteula','-s',"-w ""$dirSupportFiles""","""$dirSupportFiles\ServiceUI_x64.exe"" -process:explorer.exe ""$dirSupportFiles\Deploy-Application.exe"" -DeploymentType $DeploymentType") -PassThru
# Two Line - pass parameters as variable (maybe better readable)
[String[]]$Parameters = @(
'-accepteula'
'-s'
"-w ""$dirSupportFiles"""
"""$dirSupportFiles\ServiceUI_x64.exe"" -process:explorer.exe ""$dirSupportFiles\Deploy-Application.exe"" -DeploymentType $DeploymentType"
)
[psobject]$ExecuteProcessResult = Execute-Process -Path "$dirSupportFiles\PsExec64.exe" -Parameters $Parameters -PassThru
I havenât test it with actual PSADT and PsExec, but syntax like this "-w ""$dirSupportFiles""" makes explicit double quotes for $dirSupportFiles.
Let me know if this works for you.
By the way, How its going with deploying apps with PsExec64.exe? 
Microsoft Windows Defender Security Update: Attack Surface Reduction Rule âBlock Process Creations Originating from PSExec and WMI Commandsâ
The Attack Surface Reduction (ASR) rule introduced in Microsoft Defender blocks process creations originating from PsExec and WMI commands to mitigate potential abuse by attackers. This rule is part of Microsoftâs effort to reduce the attack surface and prevent lateral movement within networks, as PsExec and WMI are commonly exploited by malware.
I just updated from Windows Update and caught new Microsoft Windows Defender ASR rule, which prevents PsExec from running even for admin user.
Adrian_Scott has warned in this thread about potential problems having running PsExec integrated into deployment script. He was so damn right!