for all the desperate people out there who are suddenly having trouble with the new Start-ADTProcessAsUser command. This workaround might help:
on 3.10.2 works perfect:
Execute-ProcessAsUser -Path "$PSHOME\powershell.exe" -Parameters "-Command `"& { & 'C:\Test\Script.ps1'; Exit `$LastExitCode }`"" -Wait
Execute-ProcessAsUser -Path "$PSHOME\powershell.exe" -Parameters "-WindowStyle Hidden `"&{Get-AppxPackage -Name '`"$($AppVendor).$($AppName)*`"' | Remove-AppxPackage -EA SilentlyContinue}`"" -Wait
Execute-ProcessAsUser -Path "reg.exe" -Parameters "IMPORT `"$UCPath\$UCPFile`"" -Wait
Execute-ProcessAsUser -Path "msiexec.exe" -Parameters "/fud $ARPGuid /qn" -Wait
But now you need cmd /c
:
Start-ADTProcessAsUser -FilePath "cmd.exe" -ArgumentList "/C POWERSHELL -Command `"& { & 'C:\Test\Script.ps1'; Exit `$LastExitCode }`"" -HideWindow -Wait -PassThru
Start-ADTProcessAsUser -FilePath "cmd.exe" -ArgumentList "/C POWERSHELL`"&{Get-AppxPackage -Name '`"$($AppVendor).$($AppName)*`"' | Remove-AppxPackage -EA SilentlyContinue}`"" -HideWindow -Wait -PassThru
Start-ADTProcessAsUser -FilePath "cmd.exe" -ArgumentList "/C REG IMPORT `"$UCPath\$UCPFile`"" -HideWindow -Wait -PassThru
Start-ADTProcessAsUser -FilePath "cmd.exe" -ArgumentList "/C msiexec /fud $($ARPGuid) /qn" -HideWindow -Wait -PassThru #>
no further questions…