/build/static/layout/Breadcrumb_cap_w.png
11/28/2018 132 views

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

Comments



Community Chosen Answer

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! :-)

Answered 11/29/2018 by: Alex_P.
White Belt

All Answers

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...

Answered 11/28/2018 by: Alex_P.
White Belt