Permission Issue - Invoke Command

Summary:
The code below is being run from my machine, targeting a computer ‘mbsqlclx001’.
The code runs without producing an error.
I can even see the process start on the remote machines task manager.

Issue:
The PowerShell script runs all the way through however:
Once it runs the Start-Process it then pauses approx 5 seconds before exiting to the prompt.
The task manager on the target machine shows the process but it too disappears after 5 seconds.

Thoughts:
Security? Permissions? UAC?

Code (Image below also):

#Create a variable
$sqlversion = '2012-dev-x64'
#Create a persistent session
$session = New-PSSession -ComputerName mbsqlclx001
#Use Invoke-Command to launch setup.exe
Invoke-Command -Session $session {      
if (Test-Path -path 'hklm:\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQLServer\CurrentVersion\') 
    {
        Write-Host "`n SQL Server is already installed, exiting script." -BackgroundColor "Yellow" -ForegroundColor "Black"
    }
Else
    {
        Start-Process "c:\_installs\$using:sqlversion\setup.exe" -ArgumentList "/ConfigurationFile=c:\_installs\$using:sqlversion\configurationfile.ini" -Wait
    }
    }

I don’t think the process stopping is attributable to the script. The script sounds like it’s doing what it should be if the process is starting, but something else could be terminating it. Are you getting any errors in the event logs? What happens if you attempt to start the service manually? You could also throw a verbose parameter in there to see what it says.

Will,

Thank you for responding.
When I start the setup.exe directly UAC pops up.
It is the UAC window I’m afraid is cancelling the process.
I will check the event logs.

Any suggestions on handling the UAC?

SOLVED
Just to document my findings, I was able to determine the reason installation was failing.
I ran the installation on the target machine directly using Windows command prompt.
While my PowerShell script wasn’t producing errors, the errors were visible in the Windows command prompt.
My argument list (used with my setup.exe) pointed to a configurationfile that had an incompatible set of switches used which caused the cancelled installation.

Thank you Will for pointing me in the right direction, very often its the direction received that helps find the solution.

Hey there Nick,

I’m glad you were able to root out the problem! I’m always glad to give a nudge when needed. :slight_smile: