/build/static/layout/Breadcrumb_cap_w.png

Visual Studio 2017 Professional - silent Installation via powershell does not quit

Hello guys,

i´m working as a software packager in a german company.

Now i´m facing a strange issue installing Microsoft Visual Studio 2017 Professional (at least it seems being strange to me).

We are using Microsoft SCCM to deploy Software. Each Software package is created as an application in SCCM.
The package itself is using the (ingenious) AppDeployToolkit, so Visual Studio gets installed via PowerShell. 

This is the command i am using in the PSADTK to install Visual Studio:

Execute-Process -Path "$dirFiles\VS.exe" -Parameters @(   "--noweb",
                   "--add Microsoft.VisualStudio.Workload.NativeDesktop",
                   "--includeRecommended",
                   "--add Component.Incredibuild",
                   "--add Component.IncredibuildMenu",
                   "--add Microsoft.VisualStudio.Component.VC.ATLMFC",
                   "--add Microsoft.VisualStudio.Component.VC.CLI.Support",
                   "--add Microsoft.VisualStudio.Workload.VisualStudioExtension",
                   "--add Microsoft.VisualStudio.Component.AppInsights.Tools",
                   "--add Microsoft.VisualStudio.Component.ClassDesigner",
                   "--add Microsoft.VisualStudio.Workload.Office",
                   "--addProductLang en-US",
                   "--addProductLang de-DE",
                   "--downloadThenInstall",
                   "--productKey XXXXXXXXXXXXXXXXXXXXXXXXX",
                   "--quiet",
                   "--wait",
                   "--norestart"
                   )

Now when i test the installation of my package on a local virtual machine i call the deployment script from a powershell prompt.

The function Execute-Process is starting the vs.exe and then it´s waiting for the process to finish. As soon as the process has finished, the ExitCode is checked.

Here´s the Problem: Although all processes started by vs.exe are finished, the powershell script doesn´t end. It stays opened and nothing happens.

It even doesn´t matter if i use PSADT or a simple PowerShell prompt to enter the command (as Start-Process [...] -wait -passthru). It´s the same Problem in both cases.
If i create a batch file to execute the vs.exe and call the batch file from PSADTK, the cmd window  gets closed after the installation and even is giving me a return code, but the powershell script is still staying open.

If i call the deployment script from Powershell ISE, everything works fine.

I´m confused. And i don`t want to use batch instead of PSADTK for the Installation.

Does anyone have an idea how to solve this?


By the way i want to apologise for my English. I guess it´s not perfect. 


0 Comments   [ + ] Show comments

Answers (2)

Posted by: Alex_P. 6 years ago
White Belt
1

I solved the problem.

There is a process named "xgTrayIcon" which gets started during the installation of VS. As soon as that process gets killed, the installation of VS will finish. 
The powershell commandlet "Start-Process" ... -wait -passthru is always waiting for the property ".HasExited" to become true. This is only the case if the process xgTrayIcon gets killed.

But if you call Start-Process with the -wait parameter, the script will not continue until the command is executed completely so killing the xgTrayIcon will never happen.

Here is how i solved it:

Before starting the Installation of VS i call a separate script which first waits until the Installation begins (process VS running), second waits until the process VS is not running anymore (installation finished) and then kills the process xgTrayIcon. I am not waiting for the completion of the script so it is doing its Job in the Background. So as soon as the Installation has finished the xgTrayicon gets killed, the property ".HasExited" becomes true, i get my return code and the script continues...

Maybe this will help someone someday. I would be glad.

If someone would like to see the script(s), let me know.

"VS" is the process name in my case. The name is equal to the exe yo are starting for the installation.




I hope this will help someone someday! :-)

Posted by: Alex_P. 6 years ago
White Belt
0

Ok i think i just have found the solution :-)

While i was writing my question i thought "Is it really true that ALL processes started by vs.exe are finished?". It´s not true.

There are three further processes running: Incredibuild. Only when i terminate these processes, my powershell script is finishing.  That seems logical to me.

Now i have to figure out how to implement this in the right sequence...

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ