0

To give the background, I’m trying to automate silent install of our Windows application (setup.exe) on a remote machine via PowerShell scripts and it is getting stuck due to a dependency, in our case SQLExpress Edition 2005.

Since our application depends on SQLExpress, during the installation process it tries to install the SQL Server 2005 Express Edition and that's when it gets stuck forever. I can see the process (SQLExpress**.exe) in Task Manager and nothing happens after that. However this works just fine when I logged in to the remote machine and do a manual installation (run setup.exe myself) as well as run through the PowerShell script locally (so that verify no issues with setup.exe or PowerShell script)

I tried different things but of no success. There are no logs or messages anywhere. All I know is, it is stuck while the setup launches the installation of SQLExpress.

Any help will be highly appreciated.

PowerShell command:

Start-Process -FilePath "C:[myapplicatonname]\setup.exe" -ArgumentList '-s -f2"c:\LogFiles\setup.log" -K"XXXXXXX-XXXX-XXXXX;XXXX-XXXX-XXXXXX" -gS' -Wait -PassThru

PS script to silent install application remotely:

$username = "[username]"
$password = "[pwd]"

$cred = new-object -typename System.Management.Automation.PSCredential `         -argumentlist $username, $password

$testCon = Test-Connection [machine name]
echo ($testCon + "==========================")
$dc1 = New-PSSession -ComputerName \\machinename  -Credential $cred 
Enter-PSSession -Session $dc1

$script = {
    $p = Start-Process -FilePath "C:\[application name]\setup.exe" -ArgumentList  '-s -f2"c:\LogFiles\setup.log" -K"1A34AQ9-SAHYTH-UMA68;JA34AQ9-YLMT-C7THH" -gS'  -Wait -PassThru
}

invoke-command -computername \\machinename -Credential $cred -scriptblock  $script

if($p.ExitCode -ne 0)
{
    Write-Host " successfully installed"

}
else
{
    Write-Host "installer exit code  $($p.ExitCode)"
}

Exit-PSSession
Nathan Rice
  • 3,091
  • 1
  • 20
  • 30
sara
  • 21
  • 3
  • it will get stuck if there is a UAC prompt. Are you running PowerShell as Administrator on the local machine? Are you a local Administrator on both machines, or a domain admin? – Josh Petitt Apr 24 '15 at 14:10
  • Thank you so much @JoshPetitt for your quick response. I disabled UAC prompt in remote machine, added myself into admin group on the remote machine, then ran the PowerShell script as Administrator on the local machine (i'm also in the local admin group), Unfortunately still no luck, It still gets stuck at the SQLExpress installation. – sara Apr 27 '15 at 03:04

0 Answers0