dsccommunity / SqlServerDsc

This module contains DSC resources for deployment and configuration of Microsoft SQL Server.
MIT License
359 stars 224 forks source link

SqlSetup: Exit codes from setup process are not trustworthy #580

Open johlju opened 7 years ago

johlju commented 7 years ago

Details of the scenario you tried and the problem that is occurring: Currently there is no check for what exit code the setup process exits with.

In PR #578 it adds (when merged) reporting of exit code to the verbose logs when setup process exits. Also added so it catches exit code 3010 (see issue #565) so it writes a warning that reboot is required (partly fixes #565). Thus I expected exit code 0 to be 'Successful'. And maybe it is. I have not been able to verify that. And if exit code is anything but 0 and 3010 it will throw an error saying that setup failed, and check the summary,txt log file.

Well, it seems it wasn't quit that simple. I'm getting strange exit codes. Sometimes I get exit code is that sometime the exit code -2061893627 when the summary.txt file says exit code 3010. But most of the time I get the correct exit code 3010 from the process (which is correct).

I can't find any documentation around exit codes from SQL Server setup.exe.

The DSC configuration that is using the resource (as detailed as possible):

xSQLServerSetup 'InstallSQL2016'
{
    InstanceName = $Node."$($currentSqlInstance)InstanceName"
    Features = $Node."$($currentSqlInstance)InstallFeatures"
    BrowserSvcStartupType = 'Automatic'
    SQLCollation = 'Finnish_Swedish_CI_AS'
    SQLSvcAccount = $SqlServiceCredential
    AgtSvcAccount = $SqlAgentServiceCredential
    ASSvcAccount = $SqlServiceCredential
    SQLSysAdminAccounts = 'COMPANY\SQL Admins', $SqlAdministratorCredential.UserName
    SourcePath = $Node."SourcePath$($currentSqlInstance)"
    UpdateEnabled = 'False'
    SuppressReboot = $false
    ForceReboot = $false
    SourceCredential = $SqlInstallCredential

    PsDscRunAsCredential = $SqlInstallCredential

    DependsOn = '[WindowsFeature]NetFramework35','[WindowsFeature]NetFramework45'
}

Version of the Operating System, SQL Server and PowerShell the DSC Target Node is running: Windows Server 2012, SQL Server 2016, WMF 5.0

What module (SqlServer or SQLPS) and which version of the module the DSC Target Node is running: n/a

Version of the DSC module you're using, or 'dev' if you're using current dev branch: Dev

johlju commented 7 years ago

I have now change PR #578 so it does not throw an error if exit code is anything than 3010 or 0. Now if just writes a warning that process exited with exit code other than 0 (which means, if i'm not wrong, 'success') or 3010 (means 'success, but reboot required').

johlju commented 7 years ago

When doing single server installs I normally get exit code '3010'. When doing cluster install I got an exit code '0'.

VERBOSE: [SQLTEST10]: [[xSQLServerSetup]InstallSQL2014Instance] 2017-05-28_21-50-34: Started the process with id 5828 using the path 'C:\Users\admin\AppData\Local
\Temp\SQL2014SP1-ENT\setup.exe', and with a timeout value of 7200 seconds.
VERBOSE: [SQLTEST10]: [[xSQLServerSetup]InstallSQL2014Instance] 2017-05-28_21-58-08: Setup exited with code '0'.

Have not been able to reproduce the exit code -2061893627 while the 'Summary.txt' log file says exit code '3010'. I'm starting to wonder if it was me making some mistake.