powershellbuildtfsbuildazure-pipelinesvnext

Powershell script is not installing an exe while i try it runs through TFS Build


I have a powershell script which will install an exe. It works fine when i try it from a powershell ISE console, but it fails when i try it from TFS build step. Note : My TFS user, agent user and triggering user are same. Could anybody can shed some light on this issue ?

Start-Process -FilePath $installerFileName -Verb "runas" -ArgumentList $parameter -Wait

The above code is using to install the exe. $parameter is a list of custom parameters.

I am getting below error

[WixSession.GetSession][GetSessionValues]exception: Value cannot be null. Parameter name: s


Solution

  • What kind of exe are you trying to install? Dose that support silent installation? If UI pop up during the installation, then the agent needs to run in interactive mode.

    Test on my side with below command to install/unistall the notepad++ with service mode, everyting works as expected:

    start-process -FilePath "D:\Software\npp.7.5.8.Installer.x64.exe" -ArgumentList '/S' -Verb runas -Wait
    

    And:

    start-process -FilePath "C:\Program Files\Notepad++\uninstall.exe" -ArgumentList '/S' -Verb runas -Wait