V4.1.8 Start-ADTProcess not working the same way as 3.x Execute-Process

We are trying to install Oracle Virtual box extension using below commands (using extpack extensions).

Execute-Process works successfully however Start-ADTProcess gives us the prompt shown in attached image (which is not displaying with PSADT 3*) and it causes a installation to fail.

Execute-Process -Path "$Env:ProgramFiles\Oracle\VirtualBox\VBoxManage.exe"
-Parameters "extpack install --replace "$dirFiles\Oracle_VirtualBox_Extension_Pack-7.2.0-170228-ENTERPRISE.vbox-extpack""

Start-ADTProcess -FilePath "$Env:ProgramFiles\Oracle\VirtualBox\VBoxManage.exe"
-ArgumentList "extpack install --replace "Oracle_VirtualBox_Extension_Pack-7.2.6-172322-ENTERPRISE (1).vbox-extpack""

Command converted using Convert-ADTTemplate

If you're running a console app and you don't want the window, or anything to show to the user, add -CreateNoWindow to your line.

Forgot to mentioned eariler that installation is getting failed with Exit code 1.(even with ignoreexitcodes)

-CreateNoWindow also does not work here

It looks like your arrangement of double quotes to me...
You have:

Execute-Process -Path "$Env:ProgramFiles\Oracle\VirtualBox\VBoxManage.exe"
-Parameters "extpack install --replace "$dirFiles\Oracle_VirtualBox_Extension_Pack-7.2.0-170228-ENTERPRISE.vbox-extpack""

explanation:
You are opening the double quotes before extpack install... and then closing them again after ...--replace , you then briefly open (and close) a second pair of double quotes at the end of ....vbox-extpack So PowerShell does not understand what you are asking it to perform.
The same rule applies to your Start-ADTProcess command

When using multiple double quotes in a PowerShell command you need to use the escape character `.
Also it is good practice to wrap variables inside a string with $() as this ensures paths with a space in them get expanded correctly.
Please note the name and path in the 2nd "Start-ADTProcess" command is different to your first "Execute-Process" command - this might be part of the problem too.

So, your code 'should' work with these modifications (I have not updated the path or name of the .vbox-extpack file):

Execute-Process -Path "$($env:ProgramFiles)\Oracle\VirtualBox\VBoxManage.exe"
-Parameters "extpack install --replace `"$($dirFiles)\Oracle_VirtualBox_Extension_Pack-7.2.0-170228-ENTERPRISE.vbox-extpack`""

and

Start-ADTProcess -FilePath "$($env:ProgramFiles)\Oracle\VirtualBox\VBoxManage.exe"
-ArgumentList "extpack install --replace `"Oracle_VirtualBox_Extension_Pack-7.2.6-172322-ENTERPRISE (1).vbox-extpack`""
1 Like

Adrian makes a good point. Your converted line is:

Start-ADTProcess -FilePath "$Env:ProgramFiles\Oracle\VirtualBox\VBoxManage.exe"
-ArgumentList "extpack install --replace "Oracle_VirtualBox_Extension_Pack-7.2.6-172322-ENTERPRISE (1).vbox-extpack""

In the "Oracle_VirtualBox_Extension_Pack-7.2.6-172322-ENTERPRISE (1).vbox-extpack" part, there's no $($adtSession.DirFiles) part to fully qualify the path like the old line, which is likely your issue.

2 Likes

Thank you for your response.

I have executed the commands as per your suggestions. However issue is still the same.
Ideally VBoxManage.exe supposed to run the vbox-extpack with the Arguments we are passing which is not happing. Refer the Task Manager snap below.
This behavior in PSADT4 is totally different from what we observed in PSADT 3

Start-ADTProcess -FilePath "$($env:ProgramFiles)\Oracle\VirtualBox\VBoxManage.exe" -ArgumentList "extpack install --replace "$($adtSession.DirFiles)\Oracle_VirtualBox_Extension_Pack.vbox-extpack""

(With Start-ADTProcess Only VBoxManage.exe process is getting launch and it is not passing th e arguments to launch processes VBoxSDS.exe and VBoxSVC.exe)

Execute-Process -Path "$Env:ProgramFiles\Oracle\VirtualBox\VBoxManage.exe" -Parameters "extpack install --replace "$dirFiles\Oracle_VirtualBox_Extension_Pack.vbox-extpack""

(VBoxSDS.exe and VBoxSVC.exe are getting launched with Execute-Process)

Also attaching the Success and Failure screenshots for both the versions.

The StdErr from the process is saying exactly what's going on:

Are you running the 3.x and 4.x commands on the same device, or different devices? One device looks cooked to me whereas the 3.x device looks like it's not.

I can appreciate what you're saying about thinking Start-ADTProcess isn't working right, however its ultimately the single-most important function in the toolkit so if it wasn't working right, we'd absolutely know about it!

I am running the 3.x and 4.x on same device.

When I mentioned Start-ADTProcess isn't working means we are not getting the same expected result we were getting while running the same commands with Execute-Process.

Refer to my first post for more details.

Yeah but you're not getting me either, you need to refer to my post above your last one and see what the StdErr says: "VBoxManage.exe: error: Failed to create the VirtualBox object!...", etc. It indicates that there's a problem with your deployment.

When I ran Start-ADTProcess -FilePath 'C:\Program Files\Oracle\VirtualBox\VBoxManage.exe' -ArgumentList "extpack install --replace ""C:\Users\MitchRichters\Downloads\Oracle_VirtualBox_Extension_Pack-7.2.6.vbox-extpack""", everything worked fine, but I did get a console window appearing saying I needed to accept a EULA:

Once I accepted this though, everything worked fine:

To get around this, I used the following command: Start-ADTProcess -FilePath 'C:\Program Files\Oracle\VirtualBox\VBoxManage.exe' -ArgumentList "extpack install --replace ""C:\Users\MitchRichters\Downloads\Oracle_VirtualBox_Extension_Pack-7.2.6.vbox-extpack""" -CreateNoWindow -StandardInput y:

However, only the upcoming 4.2.0 release has StandardInput (stdin) support, so you'd need to use a pre-release version with your package, which you can obtain from here: Change OobeDetection to switch to NonInteractive now that we have UIA… · PSAppDeployToolkit/PSAppDeployToolkit@df032e0 · GitHub

To sum up, your screenshot of 4.1.8 not working is not at the fault of PSAppDeployToolkit v4, its the fault of your device and the StdOut in the screenshot you placed above clearly demonstrates that. If you were using 3.x and the interactivity to press Y as part of the vbox-extpack is no issue, then a working machine with 4.1.8 should work also. If you do want a truly silent experience, which you would not have been able to get on PSAppDeployToolkit 3.x as the toolkit has never had stdin support, use the pre-release I linked above with the command line I provided.

2 Likes