Unattended install fails silently, inconsistently

ismeisme Posts: 119
edited August 29, 2014 11:13AM in SQL Backup Previous Versions
Hey RG,

I'm trying to perform an unattended install on a remote computer of the SQL Backup server components, version 7.7.0.7.

The documentation for installing the server components from the command line makes it look easy.
To install the server components unattended, call SQBServerSetup.exe from the command line with /VERYSILENT and /SUPPRESSMESSAGEBOXES. For example:
SQBServerSetup.exe /VERYSILENT /SUPPRESSMSGBOXES

The server components will be installed on the local instance using the default settings unless you specify otherwise using the parameters described below.

I've tried to run this command in four different ways, but they all fail. The error varies depending on the method.

Is it a problem with the installer, or is there something missing from the documentaton?

Here's what I've tried.

1. PowerShell remote session

First I tried the Invoke-Command cmdlet to install over a PowerShell remote session.
  Write-Verbose "Installing SQL Backup"
  Invoke-Command $TargetServer {
    G:\media\SQBServerSetup.exe /VERYSILENT /SUPPRESSMSGBOXES
    $LASTEXITCODE
  }

I copied the installer to G:\media on the remote computer before running the command.

The variable $TargetServer contains the name of the remote server.

It returns instantly without a value.The $LASTEXITCODE variable is null.

2. psexec

Next I tried psexec.
psexec \\$TargetServer G:\media\SQBServerSetup.exe /VERYSILENT /SUPPRESSMSGBOXES

It didn't work either, but it at least gave me some output.
PsExec v1.98 - Execute processes remotely
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com
Connecting to REMOTESERVER...Starting PsExec service on REMOTESERVER...Connecting with PsExec service on REMOTESERVER...Starting 
G:\media\SQBServerSetup.exe on REMOTESERVER...
G:\media\SQBServerSetup.exe exited on REMOTESERVER with error code 6040.

Error code 6040 means "The password for the SQL Backup Agent service user account was invalid."

I haven't specified a user account. SQL Backup is supposed to use the SQL Server service account!

3. PowerShell over RDP

To rule out any weirdness caused by the remote execution, I opened an RDP connection and tried the PowerShell commands again.
PS G:\media> .\SQBServerSetup.exe /VERYSILENT /SUPPRESSMSGBOXES
PS G:\media> $LASTEXITCODE

Again, the command returned instantly and produced no output or exit code.

4. cmd over RDP

Maybe the installer just doesn't work in PowerShell.

Does it work in plain old cmd?
G:\media>.\SQBServerSetup.exe /VERYSILENT /SUPPRESSMSGBOXES
G:\media>echo %errorlevel%
9009

No. And error code 9009 is sadly undocumented.

How do I make this work?

Cheers,
Iain
Iain Elder, Skyscanner

Comments

  • I can't install it using the GUI tools either.

    Any ideas what the root cause could be?

    5. Using the UI over RDP

    I double click to run the installer.

    I accept all the default settings and supply the correct password for the account that SQL Server runs as.

    When I click Next at 'Select SQL Server authenticaion mode', I see an error message.
    Failed to verify that the account (DEV\sqlservice) is a member of the SQL Server sysadmin fixed server role for the selected instance. SQL error: Login failed for user 'DEV\sqlservice'.

    This installation may not be able to install the SQL Backup extended stored procedures. User another login.

    The SQL Server error log shows no failed login attempts.

    6. Using SQL Backup UI on my workstation

    I run SQL Backup on my workstatation.

    I open the "Add SQL Server" dialog, supply the server name and the correct password for the SQL Server service account, and accept the defaults.

    I click finish, SQL Compare validates the options, then the installation starts.

    It fails at the first step "Copying and running SQBServerSetup".
    REMOTESERVER: Server Component Installation - Failed
    ======================================================
    
    Copying and running SQBServerSetup - Failed
    -------------------------------------------
    
    Error running installer: exit code 6200
    The SQL Backup Agent service failed to connect to the SQL Server instance using the SQL login provided.
    

    Exit code 6200 means "SQL authenticated user name or password is invalid."

    Again, the SQL Server error log shows no failed login attempts.
    Iain Elder, Skyscanner
  • We resolved the issue this morning.

    There were two issues here. One was my mistake; the other looks like a gap in the documentation.

    1. The SQL Server service account did not have a login on the server.

    For SQL Backup to use the account, it has to be sysadmin on the server.

    I added the service account DEV\sqlservice as a sysadmin on the server.

    The server did actually log the failed logins, but I was looking in the agent log rather than the server log. D'oh!

    The UI installer over RDP gave the clearest indication of this issue. It would be helpful if the error messages were more consistent.

    2. The command line installer requires a password for the service account.

    For SQL Backup to use the service account, it needs to know the password.

    In the end, a command like this worked for me:
    psexec \\$TargetServer G:\media\SQBServerSetup.exe /VERYSILENT /SUPPRESSMSGBOXES /SVCUSER $svcuser /SVCPW $svcpw
    

    It produced a result like this:
    PsExec v1.98 - Execute processes remotely
    Copyright (C) 2001-2010 Mark Russinovich
    Sysinternals - www.sysinternals.com
    Connecting to REMOTESERVER...Starting PsExec service on REMOTESERVER...Connecting with PsExec service on REMOTESERVER...Starting 
    G:\media\SQBServerSetup.exe on REMOTESERVER...
    G:\media\SQBServerSetup.exe exited on REMOTESERVER with error code 0.
    

    The SQL Backup UI now shows a yellow "Trial" icon next to the server. Success!

    The command line installer does not force you to provide a password, and the documentation suggests that one is unnecessary to use the server's account.

    I imagine this would work if the server is running under one the default Windows accounts, but we use dedicated service accounts with passwords.

    It would be helpful if the documentation was clearer on this point.

    As a security note, I don't recommend using my solution for a production deployment. psexec does not encrypt its connection to the remote server. Don't allow someone to sniff your production password over the network!
    Iain Elder, Skyscanner
  • Eddie DEddie D Posts: 1,803 Rose Gold 5
    Thank you for your forum post.

    If you do not specify the /SVCUSER /SVCPW parameters SQL Backup server components installer default to the account the SQL Server instance is currently running as is used.

    I suspect if you included the /LOG parameter, the log file may have indicated the reason why login attempted failed.

    Good news that you were able to identify the cause and remedy the problem. Also thank you for sharing your experiences via the forum. I am sure other users will benefit from steps you have undertaken.

    Many Thanks
    Eddie
    Eddie Davis
    Senior Product Support Engineer
    Redgate Software Ltd
    Email: support@red-gate.com
Sign In or Register to comment.