Giter VIP home page Giter VIP logo

Comments (22)

bodunjo avatar bodunjo commented on May 18, 2024 1

I've just realised that some of the SQL features will not work and will throw the error message above.
Some of the features that are buggy as far as my testing goes are: FullText,SNAC_SDK,Conn,DQ,BC,DQC,Replication,MDS,Tools.
Not sure as to what the fixes are. Quite new to PS DSC.

from sqlserverdsc.

johlju avatar johlju commented on May 18, 2024

Could you please show how your config looks like?

from sqlserverdsc.

Arturas-K avatar Arturas-K commented on May 18, 2024

Hi,

This error usually means that one or more features listed in configuration was not detected by test method after setup has completed.

I see that you are specified SQLENGINE,ADV_SSMS
Try adding SSMS feature to feature list: SQLENGINE,SSMS,ADV_SSMS.

I think i had similar issue a while back, so i'm specifying both in all my scripts, not sure if this is still needed thou.

You can also troubleshoot by executing Get-DscConfiguration on target machine, this should output what features are detected.

from sqlserverdsc.

bodunjo avatar bodunjo commented on May 18, 2024

I ran Get-DSCConfiguration

Here is the result i got:

PS C:\Program Files\WindowsPowerShell\Modules> Get-dscConfiguration
WARNING: [LONSQL60A]: [] The GET operation will be carried against a pending configuration since the latest configuration has not converged yet.

ConfigurationName : SqlServerSetup
DependsOn :
ModuleName : PSDesiredStateConfiguration
ModuleVersion : 1.1
PsDscRunAsCredential :
ResourceId : [Script]DisableFirewall
SourceInfo :
Credential :
GetScript :
@{
Getscript = $Getscript
Setscript = $Setscript
Testscript= $Testscript
Result = -not('True' -in (Get-NetFirewallProfile -All).Enable)
}

Result : True
SetScript :
Set-NetFirewallProfile -All -Enabled False -verbose

TestScript :
$status = -not('True' -in (Get-NetFirewallProfile -All).Enabled)
$status -eq $True

PSComputerName :
CimClassName : MSFT_ScriptResource

ConfigurationName : SqlServerSetup
DependsOn : {[Script]DisableFirewall}
ModuleName : PSDesiredStateConfiguration
ModuleVersion :
PsDscRunAsCredential :
ResourceId : [File]DSCResourceFolder
SourceInfo :
Attributes : {system, directory}
Checksum :
Contents :
CreatedDate : 22/08/2013 16:39:31
Credential :
DestinationPath : C:\Program Files\WindowsPowerShell\Modules
Ensure : present
Force :
MatchSource :
ModifiedDate : 28/07/2016 17:50:10
Recurse :
Size : 0
SourcePath :
SubItems :
Type : directory
PSComputerName :
CimClassName : MSFT_FileDirectoryConfiguration

ConfigurationName : SqlServerSetup
DependsOn : {[File]DSCResourceFolder}
ModuleName : PSDesiredStateConfiguration
ModuleVersion : 1.1
PsDscRunAsCredential :
ResourceId : [WindowsFeature]NTFranmeworkcore
SourceInfo :
Credential :
DisplayName : .NET Framework 3.5 (includes .NET 2.0 and 3.0)
Ensure : Present
IncludeAllSubFeature : False
LogPath :
Name : NET-Framework-Core
Source :
PSComputerName :
CimClassName : MSFT_RoleResource

ConfigurationName : SqlServerSetup
DependsOn : {[WindowsFeature]NTFranmeworkcore}
ModuleName : xSQLServer
ModuleVersion : 1.5.0.0
PsDscRunAsCredential :
ResourceId : [xSQLServerSetup]SqlInstaller
SourceInfo :
AgtSvcAccount :
AgtSvcAccountUsername :
ASBackupDir :
ASCollation :
ASConfigDir :
ASDataDir :
ASLogDir :
ASSvcAccount :
ASSvcAccountUsername :
ASSysAdminAccounts :
ASTempDir :
BrowserSvcStartupType :
ErrorReporting :
Features :
ForceReboot :
FTSvcAccount :
FTSvcAccountUsername :
InstallSharedDir :
InstallSharedWOWDir :
InstallSQLDataDir :
InstanceDir :
InstanceID :
InstanceName : MSSQLSERVER
ISSvcAccount :
ISSvcAccountUsername :
PID :
RSSvcAccount :
RSSvcAccountUsername :
SAPwd :
SecurityMode :
SetupCredential :
SourceCredential :
SourceFolder :
SourcePath : Z:
SQLBackupDir :
SQLCollation :
SQLSvcAccount :
SQLSvcAccountUsername :
SQLSysAdminAccounts :
SQLTempDBDir :
SQLTempDBLogDir :
SQLUserDBDir :
SQLUserDBLogDir :
SQMReporting :
SuppressReboot :
UpdateEnabled :
UpdateSource :
PSComputerName :
CimClassName : MSFT_xSQLServerSetup

from sqlserverdsc.

Arturas-K avatar Arturas-K commented on May 18, 2024

so SSMS failed to install, you should look at setup logs.
They can be found at C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Log<Date_time>
You should be able to find a cause there.

Maybe you are missing a prerequisite.

Have you tried with specifying SSMS and ADV_SSMS features?

from sqlserverdsc.

bodunjo avatar bodunjo commented on May 18, 2024

I added the setup long at the bottom of the initial post.

Get Outlook for Android

On Fri, Jul 29, 2016 at 1:27 PM +0100, "Arturas Kuznecovas" [email protected] wrote:

so SSMS failed to install, you should look at setup logs.
They can be found at C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Log<Date_time>
You should be able to find a cause there.

Maybe you are missing a prerequisite.

Have you tried with specifying SSMS and ADV_SSMS features?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#88 (comment)

from sqlserverdsc.

bodunjo avatar bodunjo commented on May 18, 2024

Yes i did. i added it as shown in the below result:
VERBOSE: [LONSQL60A]: [[xSQLServerSetup]SqlInstaller] Process matching path 'Z:\setup.exe' started in process ID 4632
VERBOSE: [LONSQL60A]: [[xSQLServerSetup]SqlInstaller] Importing function 'GetxPDTVariable'.
VERBOSE: [LONSQL60A]: [[xSQLServerSetup]SqlInstaller] Importing function 'NetUse'.
VERBOSE: [LONSQL60A]: [[xSQLServerSetup]SqlInstaller] Importing function 'ResolvePath'.
VERBOSE: [LONSQL60A]: [[xSQLServerSetup]SqlInstaller] Importing function 'StartWin32Process'.
VERBOSE: [LONSQL60A]: [[xSQLServerSetup]SqlInstaller] Importing function 'WaitForWin32ProcessEnd'.
VERBOSE: [LONSQL60A]: [[xSQLServerSetup]SqlInstaller] Path: Z:\setup.exe
VERBOSE: [LONSQL60A]: [[xSQLServerSetup]SqlInstaller] Features found: ''
VERBOSE: [LONSQL60A]: [[xSQLServerSetup]SqlInstaller] Unable to find feature 'SQLENGINE' in ''
VERBOSE: [LONSQL60A]: [[xSQLServerSetup]SqlInstaller] Unable to find feature 'SSMS' in ''
VERBOSE: [LONSQL60A]: [[xSQLServerSetup]SqlInstaller] Unable to find feature 'ADV_SSMS' in ''
VERBOSE: [LONSQL60A]: [[xSQLServerSetup]SqlInstaller] Test-TargetResource returned false after calling set. | ErrorType: MSFT_xSQLServerSetup.TestFailedAfterSet
VERBOSE: [LONSQL60A]: LCM: [ End Set ] [[xSQLServerSetup]SqlInstaller] in 15.1870 seconds.
PowerShell DSC resource MSFT_xSQLServerSetup failed to execute Set-TargetResource functionality with error message: Test-TargetResource returned false after calling set.
+ CategoryInfo : InvalidOperation: (:) [], CimException
+ FullyQualifiedErrorId : ProviderOperationExecutionFailure
+ PSComputerName : LONSQL60A

VERBOSE: [LONSQL60A]: LCM: [ End Set ]
The SendConfigurationApply function did not succeed.
+ CategoryInfo : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : MI RESULT 1
+ PSComputerName : LONSQL60A

VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 27.103 seconds

from sqlserverdsc.

johlju avatar johlju commented on May 18, 2024

I think I have seen this error before. I can be wrong, but I think it was when SourceCredential was not set. When SourceCredential is set, it does RoboCopy to local disk before starting setup. If SourceCredential is not set then it tries to start the setup from the SourcePath+SourceFolder, and accessing it over UNC, and at that point I think I got CIMSession error.

Can you verify if you are using SourceCredential or not? So we can rule that out.

This is how my config looks like. I used it yesterday with the latest dev-branch without any problems.

xSQLServerSetup InstallSqlServer
{
    InstanceName = $Node.SqlInstanceName
    Features= $Node.SqlInstallFeatures
    BrowserSvcStartupType = 'Automatic'
    SQLCollation = 'Latin1_General_CI_AS_KS_WS'
    SQLSvcAccount = $SqlServiceCredentialNode2
    AgtSvcAccount = $SqlAgentServiceCredentialNode2
    SQLSysAdminAccounts = $SqlAdministratorCredential.UserName
    SetupCredential = $SqlInstallCredential

    SourcePath = $Node.SourcePath
    SourceFolder = $Node.SourceFolder
    SourceCredential = $SqlInstallCredential

    UpdateSource = '.\Updates'
    UpdateEnabled = 'True'

    SuppressReboot = $False
    ForceReboot = $False
}

from sqlserverdsc.

bodunjo avatar bodunjo commented on May 18, 2024

Well, everything was copied locally and and the ISO files ae mounted on the server and filled in the administrator's credential, the share path's credential including the SA account credential. Not sure why this is not working.

from sqlserverdsc.

johlju avatar johlju commented on May 18, 2024

And as @Arturas-K say maybe you are missing a prereq? I do the following before installing SQL, just to make sure they are there.

        WindowsFeature NET35 {
           Name = 'NET-Framework-Core'
           Source = $node.WindowsSourceSxs
           Ensure = 'Present'
        }

        WindowsFeature NET45 {
           Name = 'NET-Framework-45-Core'
           Ensure = 'Present'
        }

Alos, if setup process is starting, as @Arturas-K say, check the SQL setup logs, because then it might be something SQL specific error (outside of DSC).

from sqlserverdsc.

Arturas-K avatar Arturas-K commented on May 18, 2024

Yes you are correct not all features are detected by Get method, so it will be installed but then not detected and will throw error that test method failed after set.

But one correction, Replication feature does work, i have fixed that in PR #20 and i'm using it to build my devtest environments so it is definitely working on SQL2008R2 and SQL2012

Regards

from sqlserverdsc.

bodunjo avatar bodunjo commented on May 18, 2024

OK. I've never used this on SQL server 2008,R2 and 2012. All my testing has been on SQL 2014 so far.
I got another question that is completely unrelated. What's the best way to implement the post SQL server installation configurations using DSC

----- Reply message -----
From: "Arturas Kuznecovas" [email protected]
To: "PowerShell/xSQLServer" [email protected]
Cc: "bodunjo" [email protected], "Author" [email protected]
Subject: [PowerShell/xSQLServer] PowerShell DSC resource MSFT_xSQLServerSetup failed to execute Set-TargetResource functionality with error message: Test-TargetResource returned false after calling set. (#88)
Date: Tue, Aug 9, 2016 08:04

Yes you are correct not all features are detected by Get method, so it will be installed but then not detected and will throw error that test method failed after set.

But one correction, Replication feature does work, i have fixed that in PR #20 and i'm using it to build my devtest environments so it is definitely working on SQL2008R2 and SQL2012

Regards


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#88 (comment)

from sqlserverdsc.

bodunjo avatar bodunjo commented on May 18, 2024

I'm finding it difficult to install a default instance. Also, how do i set up dedicated SQL service accounts based on IS,AS,RS,DE,FT on each environment? Not sure if i'll have to leave the instance name empty when installing a default instance or not. Error message below:

VERBOSE: [LONSQL60B]: [[xSQLServerSetup]SqlInstaller] Path: F:\setup.exe
VERBOSE: [LONSQL60B]: [[xSQLServerSetup]SqlInstaller] Detecting replication feature
VERBOSE: [LONSQL60B]: [[xSQLServerSetup]SqlInstaller] Reading registry key HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL12.DBADSC\ConfigurationState
VERBOSE: [LONSQL60B]: [[xSQLServerSetup]SqlInstaller] Registry entry SQL_Replication_Core_Inst = 1
VERBOSE: [LONSQL60B]: [[xSQLServerSetup]SqlInstaller] Replication feature detected
Exception calling "Connect" with "1" argument(s): "The 'DBADSC' instance was not found on the 'localhost' server."
+ CategoryInfo : NotSpecified: (:) [], CimException
+ FullyQualifiedErrorId : ConnectionException
+ PSComputerName : LONSQL60B

VERBOSE: [LONSQL60B]: LCM: [ End Test ] [[xSQLServerSetup]SqlInstaller] in 61.3920 seconds.
The PowerShell DSC resource '[xSQLServerSetup]SqlInstaller' with SourceInfo '::115::5::xSqlServerSetup' threw one or more non-terminating errors while running the Test-TargetResource
functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
+ CategoryInfo : InvalidOperation: (:) [], CimException
+ FullyQualifiedErrorId : NonTerminatingErrorFromProvider
+ PSComputerName : LONSQL60B

VERBOSE: [LONSQL60B]: LCM: [ Start Resource ] [[WindowsFeature]WindowsPowerShell50]
VERBOSE: [LONSQL60B]: LCM: [ Start Test ] [[WindowsFeature]WindowsPowerShell50]
VERBOSE: [LONSQL60B]: [[WindowsFeature]WindowsPowerShell50] The operation 'Get-WindowsFeature' started: PowerShell
VERBOSE: [LONSQL60B]: [[WindowsFeature]WindowsPowerShell50] The operation 'Get-WindowsFeature' succeeded: PowerShell
VERBOSE: [LONSQL60B]: LCM: [ End Test ] [[WindowsFeature]WindowsPowerShell50] in 0.7490 seconds.

from sqlserverdsc.

johlju avatar johlju commented on May 18, 2024

@bodunjo Sorry for taking so long to answer. You need to set the instance name to MSSQLSERVER for the default instance.

You need to see each parameter to a PSCredential object, like $cred = Get-Credential, to use separate service accounts. For parameters you can look at the README.md

For AS use parameter ASSvcAccount
For IS use parameter ISSvcAccount
For RS use parameter RSSvcAccount
For DE use parameter SQLSvcAccount
For FT use parameter FTSvcAccount

Let me know if you need help with anything else. 😄

from sqlserverdsc.

johlju avatar johlju commented on May 18, 2024

@bodunjo I'm closing this issue since we have not heard anything more from you in a while. Please feel free to open up the issue again if you need further help.

from sqlserverdsc.

bodunjo avatar bodunjo commented on May 18, 2024

@johlju thanks a million for getting back to me. I've just had the time to test again. I did what you recommended above to try SQL 2016 installation. The install went ok but the service accounts are not applied still. it's showing as SQLAgent$BAUTEST3 intead of using the designated service accounts.

Here is my script:

$config = @{
  AllNodes = @(
        #@{NodeName = "Server1";PsDscAllowPlaintextPassword = $true}
       

   )
}
configuration TestScript {

PARAM ( 
        [PSCredential]$SACredential,
        [string]$ModuleSourcePath,
        [string]$ModuleDestinationPath,
        [string]$NetSourcePath,
        #[string]$InstanceName,
        [PSCredential]$ShareCredential,
        [PSCredential]$SourceCredential,
        [PSCredential]$Cred,
        [PSCredential]$Setupcredential,
        [PSCredential]$AgtSvcAccount,
        [PSCredential]$SQLSvcAccount,
       
        #[PSCredential]$Username, # = "domain\username",
        [PSCredential]$Password # = (Get-Content c:\Temp\password.txt | ConvertTo-SecureString)
        #[PSCredential]$AGsvcAccount,
        #[PSCredential]$DEsvcAccount
 
     )



Import-DscResource -Module xSQLServer,PSDesiredStateConfiguration, xActiveDirectory,xstorage

$AGsvcAccount = $SQLServer + "AG"
$DEsvcAccount = $SQLServer + "DE"
$FTSvcAccount = $SQLServer + "FT"
$ASSvcAccount = $SQLServer + "AS"
$ISSvcAccount = $SQLServer + "IS"
$RSSvcAccount = $SQLServer + "RS"
$ASSvcAccount = $SQLServer + "AS"
       
       
$SQLSvcAccountUsername = $DomainName + "\" + $DEsvcAccount
$AgtSvcAccountUsername = $DomainName + "\" + $AGsvcAccount
$FTSvcAccountUsernamee = $DomainName + "\" + $FTSvcAccount
$RSSvcAccountUsername = $DomainName + "\" + $RSSvcAccount
$ISSvcAccountUsername = $DomainName + "\" + $ISSvcAccount
$ASSvcAccountUsername = $DomainName + "\" + $ASSvcAccount   

    
$InstanceName = "BAUTEST4" #fill in the name of the instance if not default
$SQLServer = $env:computername
$DomainName = $env:USERDOMAIN






Node $Allnodes.Nodename {



        Log ParamLog
        {
            Message = "Running SQLInstall. PackagePath = $PackagePath"
        }

  Script ShowUser
        {
            GetScript = { }
            TestScript = { $False }
            SetScript = 
            {
            write-verbose "User: $([System.Security.Principal.WindowsIdentity]::GetCurrent().Name)"
            write-verbose "Current User: $env:UserName"
            }
        }

   File ModuleCopy
        {
            Ensure = "Present"  # You can also set Ensure to "Absent"
            Type = "Directory" # Default is "File".
            Recurse = $true # Ensure presence of subdirectories, too
            SourcePath = $ModuleSourcePath
            DestinationPath = $ModuleDestinationPath 
            Dependson = "[Script]ShowUser"  
        }




   WindowsFeature WindowsPowerShell50 
		{
			Ensure = 'Present' 
			Name = 'PowerShell'
            Dependson = "[File]ModuleCopy"
            PsDscRunAsCredential = $cred
		}

		
  WindowsFeature WindowsPowerShellISE 
		{
			Ensure = 'Present' 
			Name = 'PowerShell-ISE'
            Dependson = "[WindowsFeature]WindowsPowerShell50"
            PsDscRunAsCredential = $cred
		}


WindowsFeature ActiveDirectoryModuleForWindowsPowerShell 
		{
			Ensure = 'Present' 
			Name = 'RSAT-AD-PowerShell'
            Dependson = "[WindowsFeature]WindowsPowerShellISE"
            PsDscRunAsCredential = $cred
		}

 


  xADUser $AGsvcAccount
		{
			#DomainAdministratorCredential = $cred
			DomainName = $DomainName
			UserName =  $AGsvcAccount
			Password = $password
			PasswordNeverExpires = $true
			Ensure = 'Present'
            Path = 'OU=Service Logons - non-compliant,OU=IT,DC=domain,DC=com'
            PsDscRunAsCredential = $cred
            Dependson = "[WindowsFeature]ActiveDirectoryModuleForWindowsPowerShell"
            Enabled = $true
		}

  xADUser $DEsvcAccount
		{
			#DomainAdministratorCredential = $cred
			DomainName = $DomainName
			UserName =  $DEsvcAccount
			Password = $password
			PasswordNeverExpires = $true
			Ensure = 'Present'
            Path = 'OU=Service Logons - non-compliant,OU=IT,DC=domain,DC=com'
            PsDscRunAsCredential = $cred
            Dependson = "[xADUser]$AGsvcAccount"
            Enabled = $true
		}



  xMountImage OSImage
        {
            ImagePath = "\\Share\SQL Team\SQLInstalls\SW_DVD9_Windows_Svr_Std_and_DataCtr_2012_R2_64Bit_English_-4_MLF_X19-82891.ISO"
            #Name = "Win2012R2"
            DependsOn = "[File]ModuleCopy"
            DriveLetter = "O:"
            Ensure = "Present"
            #PsDscRunAsCredential = $cred
        }



  xMountImage SQLImage
        {
            ImagePath = "\\Share\SQL Team\SQLInstalls\SQL Server 2016 Developer\en_sql_server_2016_developer_x64_dvd_8777069.iso"
            #Name = "SQL2016"
            DependsOn = "[xMountImage]OSImage"
            DriveLetter = "K:"
            Ensure = "Present"
            #PsDscRunAsCredential = $cred
        }

       
 
 WindowsFeature NetFramework35Core
        {
            Name = "NET-Framework-Core"
            Ensure = "Present"
            Source = "O:\sources\sxs"
            DependsOn = "[xMountImage]OSImage"
        }
 
 WindowsFeature NetFramework45Core
        {
            Name = "NET-Framework-45-Core"
            Ensure = "Present"
            Source = "O:\sources\sxs"
            DependsOn = "[WindowsFeature]NetFramework35Core"
        }

        # Install SqlServer using ini file
       
   <#    
      Script InstallSQL
        {

             GetScript =
            {
               # Do Nothing
                
            }

             SetScript = {
             $currentTime = Get-Date
             $InstallSQL = C:\DBA\SQLDSC\SQLInstaller.ps1

            }

          TestScript = {
            
                $false
            }
            Dependson = "[xMountImage]SQLImage"

        }


      
#>
 xSQLServersetup SQL2016

     {
        InstanceName = $InstanceName 
        Setupcredential = $Setupcredential
        SApwd = $SACredential
        SourcePath = 'K:'
        SourceFolder = ""
        FEATURES="SQLENGINE,RS,IS,SQL" #FullText,SNAC_SDK,Conn,DQ,BC,DQC,Replication,MDS,Tools
        InstallSharedDir = "C:\Program Files"
        InstallSharedWOWDir = "C:\Program Files (x86)"
        InstanceDir = "D:\Program Files\Microsoft SQL Server"
        InstallSQLDataDir = "H:\SQLData"
        SQLUserDBDir = "H:\SQLData"
        SQLUserDBLogDir = "L:\SQLLogs"
        SQLTempDBDir = "H:\SQLTemp\$InstanceName"
        SQLTempDBLogDir = "L:\SQLTempLog\$InstanceName"
        SQLBackupDir = "H:\SQLData"
        ASDataDir = "C:\Program Files"
        ASLogDir = "C:\Program Files"
        ASBackupDir = "C:\Program Files"
        ASTempDir = "C:\Program Files"
        ASConfigDir = "C:\Program Files"
        UpdateSource = "MU" # set this to windows update, otherwise it will use the default and cause the setup to crash
        UpdateEnabled = 'True'
        SuppressReboot = $False
        ForceReboot = $False
        PsDscRunAsCredential = $cred
        FTSvcAccount = $cred
        ASSvcAccount = $cred
        ASSysAdminAccounts = $cred
        ISSvcAccount = $cred
        RSSvcAccount = $cred
        ASCollation = 'Latin1_General_CI_AS_KS_WS'
        SQLSvcAccount = $SQLSvcAccountCred
        SQLCollation = 'Latin1_General_CI_AS_KS_WS'
        AGTSVCACCOUNT= $AgtSvcAccountCred
        SQLSysAdminAccounts = "domain\dl_sqladmins"
        #PID =
        Dependson = "[WindowsFeature]NetFramework45Core"
     }


Script InstallSSMS
        {

             GetScript =
            {
                # Do Nothing 
                
            }

            SetScript = 
            {
            $currentTime = Get-Date
            $InstallSSMS = C:\DBA\SQLDSC\SSMSInstaller2.ps1  

            }

            TestScript = 
            {
            
                $false
            }
            Dependson = "[xSQLServersetup]SQL2016"

        }


         # Set LCM to reboot if needed
 LocalConfigurationManager
        {
            DebugMode = "All"
            RebootNodeIfNeeded = $true
            ConfigurationMode = 'ApplyAndAutoCorrect'
            AllowModuleOverwrite = $true
            RefreshMode = 'Push'
            ActionAfterReboot = 'ContinueConfiguration'
           
        }
  }
        
    }

    

#Read-Host –AsSecureString | ConvertFrom-SecureString | Out-File C:\DBA\SQLDSC\SACredential.txt
#Read-Host –AsSecureString | ConvertFrom-SecureString | Out-File C:\DBA\SQLDSC\password.txt
#Read-Host –AsSecureString | ConvertFrom-SecureString | Out-File C:\DBA\SQLDSC\AgtSvcAccountpassword.txt
#Read-Host –AsSecureString | ConvertFrom-SecureString | Out-File C:\DBA\SQLDSC\SQLSvcAccountpassword.txt


$Username = "domain\domain\username"
$password = Get-Content C:\DBA\SQLDSC\password.txt | ConvertTo-SecureString
$SApassword = Get-Content C:\DBA\SQLDSC\SACredential.txt | ConvertTo-SecureString
$Cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $Username, $password
#$InstanceName = "SharePoint" #fill in the name of the instance if not default


#$AgtSvcAccountUsername = $AgtSvcAccountUsername
#$SQLSvcAccountUsername = $SQLSvcAccountUsername
$AgtSvcAccountpassword = Get-Content C:\DBA\SQLDSC\AgtSvcAccountpassword.txt | ConvertTo-SecureString
$SQLSvcAccountpassword = Get-Content C:\DBA\SQLDSC\SQLSvcAccountpassword.txt | ConvertTo-SecureString
$AgtSvcAccountCred = new-object -typename System.Management.Automation.PSCredential -argumentlist $AgtSvcAccountUsername, $AgtSvcAccountpassword
$SQLSvcAccountCred = new-object -typename System.Management.Automation.PSCredential -argumentlist $SQLSvcAccountUsername, $SQLSvcAccountpassword



                      $values = @{
                                "Setupcredential" =$cred;
                                "ShareCredential" = $cred;
                                "SACredential" = $cred;
                                "SourceCredential" = $cred;
                                "ModuleSourcePath" = "\\Share\SQL Team\SQLInstalls\SQLInstaller\Modules";
                                "ModuleDestinationPath" = "C:\Program Files\WindowsPowerShell\Modules";
                                "NetSourcePath" = "O:\sources";
                                #"InstanceName" = 'BAU'
                                #"AGTSVCACCOUNT=" = $AgtSvcAccountCred;
                                "SQLSvcAccount" = $cred
                                };

CD C:\DBA\SQLDSC

Testscript @values -configurationdata $config
Start-DscConfiguration  -Path C:\DBA\SQLDSC\TestScript -Credential (Get-Credential -UserName "domain\domain\username" -Message 'Enter Credential for configuration') -Wait -Verbose -force

and here is the error message:

VERBOSE: [Server1]:                            [[xSQLServerSetup]SQL2016::[TestScript]::[TestScript]] Importing function 'GetxPDTVariable'.
VERBOSE: [Server1]:                            [[xSQLServerSetup]SQL2016::[TestScript]::[TestScript]] Importing function 'NetUse'.
VERBOSE: [Server1]:                            [[xSQLServerSetup]SQL2016::[TestScript]::[TestScript]] Importing function 'ResolvePath'.
VERBOSE: [Server1]:                            [[xSQLServerSetup]SQL2016::[TestScript]::[TestScript]] Importing function 'StartWin32Process'.
VERBOSE: [Server1]:                            [[xSQLServerSetup]SQL2016::[TestScript]::[TestScript]] Importing function 'WaitForWin32ProcessEnd'.
VERBOSE: [Server1]:                            [[xSQLServerSetup]SQL2016::[TestScript]::[TestScript]] Path: K:\setup.exe
VERBOSE: [Server1]:                            [[xSQLServerSetup]SQL2016::[TestScript]::[TestScript]] Test-TargetResource returned false after calling set. 
| ErrorType: MSFT_xSQLServerSetup.TestFailedAfterSet
VERBOSE: [Server1]: LCM:  [ End    Set      ]  [[xSQLServerSetup]SQL2016::[TestScript]::[TestScript]]  in 54.4550 seconds.
PowerShell DSC resource MSFT_xSQLServerSetup  failed to execute Set-TargetResource functionality with error message: Test-TargetResource returned false after 
calling set. 
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : ProviderOperationExecutionFailure
    + PSComputerName        : Server1
 
VERBOSE: [Server1]: LCM:  [ End    Set      ]
The SendConfigurationApply function did not succeed.
    + CategoryInfo          : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
    + FullyQualifiedErrorId : MI RESULT 1
    + PSComputerName        : Server1
 
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 65.472 seconds

Overall summary:
  Final result:                  Failed: see details below
  Exit code (Decimal):           -2061762559
  Exit facility code:            1308
  Exit error code:               1
  Exit message:                  The credentials you provided for the 'SQLAgent$BAUTEST4' service is invalid.
  Start time:                    2017-01-10 15:58:04
  End time:                      2017-01-10 15:58:44
  Requested action:              Install

Setup completed with required actions for features.
Troubleshooting information for those features:
  Next step for SQLEngine:       SQL Server Setup was canceled before completing the operation. Try the setup process again.
  Next step for Replication:     SQL Server Setup was canceled before completing the operation. Try the setup process again.
  Next step for FullText:        SQL Server Setup was canceled before completing the operation. Try the setup process again.
  Next step for DQ:              SQL Server Setup was canceled before completing the operation. Try the setup process again.
  Next step for RS:              SQL Server Setup was canceled before completing the operation. Try the setup process again.

Install Summary:


Package properties:
  Description:                   Microsoft SQL Server 2016 
  ProductName:                   SQL Server 2016
  Type:                          RTM
  Version:                       13
  SPLevel:                       0
  Installation location:         K:\x64\setup\
  Installation edition:          Developer

Product Update Status:
  None discovered.

User Input Settings:
  ACTION:                        Install
  ADDCURRENTUSERASSQLADMIN:      false
  AGTSVCACCOUNT:                 domain\server1AG
  AGTSVCPASSWORD:                *****
  AGTSVCSTARTUPTYPE:             Automatic
  ASBACKUPDIR:                   Backup
  ASCOLLATION:                   Latin1_General_CI_AS
  ASCONFIGDIR:                   Config
  ASDATADIR:                     Data
  ASLOGDIR:                      Log
  ASPROVIDERMSOLAP:              1
  ASSERVERMODE:                  MULTIDIMENSIONAL
  ASSVCACCOUNT:                  <empty>
  ASSVCPASSWORD:                 <empty>
  ASSVCSTARTUPTYPE:              Automatic
  ASSYSADMINACCOUNTS:            <empty>
  ASTELSVCACCT:                  <empty>
  ASTELSVCPASSWORD:              <empty>
  ASTELSVCSTARTUPTYPE:           0
  ASTEMPDIR:                     Temp
  BROWSERSVCSTARTUPTYPE:         Disabled
  CLTCTLRNAME:                   <empty>
  CLTRESULTDIR:                  <empty>
  CLTSTARTUPTYPE:                0
  CLTSVCACCOUNT:                 <empty>
  CLTSVCPASSWORD:                <empty>
  CLTWORKINGDIR:                 <empty>
  COMMFABRICENCRYPTION:          0
  COMMFABRICNETWORKLEVEL:        0
  COMMFABRICPORT:                0
  CONFIGURATIONFILE:             
  CTLRSTARTUPTYPE:               0
  CTLRSVCACCOUNT:                <empty>
  CTLRSVCPASSWORD:               <empty>
  CTLRUSERS:                     <empty>
  ENABLERANU:                    false
  ENU:                           true
  EXTSVCACCOUNT:                 <empty>
  EXTSVCPASSWORD:                <empty>
  FEATURES:                      SQLENGINE, REPLICATION, FULLTEXT, DQ, RS
  FILESTREAMLEVEL:               0
  FILESTREAMSHARENAME:           <empty>
  FTSVCACCOUNT:                  NT Service\MSSQLFDLauncher$BAUTEST4
  FTSVCPASSWORD:                 <empty>
  HELP:                          false
  IACCEPTROPENLICENSETERMS:      false
  IACCEPTSQLSERVERLICENSETERMS:  true
  INDICATEPROGRESS:              false
  INSTALLSHAREDDIR:              C:\Program Files\Microsoft SQL Server\
  INSTALLSHAREDWOWDIR:           C:\Program Files (x86)\Microsoft SQL Server\
  INSTALLSQLDATADIR:             H:\SQLData
  INSTANCEDIR:                   D:\Program Files\Microsoft SQL Server
  INSTANCEID:                    BAUTEST4
  INSTANCENAME:                  BAUTEST4
  ISSVCACCOUNT:                  NT AUTHORITY\Network Service
  ISSVCPASSWORD:                 <empty>
  ISSVCSTARTUPTYPE:              Automatic
  ISTELSVCACCT:                  <empty>
  ISTELSVCPASSWORD:              <empty>
  ISTELSVCSTARTUPTYPE:           0
  MATRIXCMBRICKCOMMPORT:         0
  MATRIXCMSERVERNAME:            <empty>
  MATRIXNAME:                    <empty>
  MRCACHEDIRECTORY:              
  NPENABLED:                     0
  PBDMSSVCACCOUNT:               <empty>
  PBDMSSVCPASSWORD:              <empty>
  PBDMSSVCSTARTUPTYPE:           0
  PBENGSVCACCOUNT:               <empty>
  PBENGSVCPASSWORD:              <empty>
  PBENGSVCSTARTUPTYPE:           0
  PBPORTRANGE:                   <empty>
  PBSCALEOUT:                    false
  PID:                           *****
  QUIET:                         true
  QUIETSIMPLE:                   false
  ROLE:                          
  RSINSTALLMODE:                 DefaultNativeMode
  RSSHPINSTALLMODE:              DefaultSharePointMode
  RSSVCACCOUNT:                  NT Service\ReportServer$BAUTEST4
  RSSVCPASSWORD:                 <empty>
  RSSVCSTARTUPTYPE:              Automatic
  SAPWD:                         <empty>
  SECURITYMODE:                  <empty>
  SQLBACKUPDIR:                  H:\SQLData
  SQLCOLLATION:                  Latin1_General_CI_AS_KS_WS
  SQLSVCACCOUNT:                 domain\server1DE
  SQLSVCINSTANTFILEINIT:         false
  SQLSVCPASSWORD:                *****
  SQLSVCSTARTUPTYPE:             Automatic
  SQLSYSADMINACCOUNTS:           domain\user1,domain\dl_sqladmins
  SQLTELSVCACCT:                 NT Service\SQLTELEMETRY$BAUTEST4
  SQLTELSVCPASSWORD:             <empty>
  SQLTELSVCSTARTUPTYPE:          Automatic
  SQLTEMPDBDIR:                  H:\SQLTemp\BAUTEST4
  SQLTEMPDBFILECOUNT:            8
  SQLTEMPDBFILEGROWTH:           64
  SQLTEMPDBFILESIZE:             8
  SQLTEMPDBLOGDIR:               L:\SQLTempLog\BAUTEST4
  SQLTEMPDBLOGFILEGROWTH:        64
  SQLTEMPDBLOGFILESIZE:          8
  SQLUSERDBDIR:                  H:\SQLData
  SQLUSERDBLOGDIR:               L:\SQLLogs
  SUPPRESSPRIVACYSTATEMENTNOTICE: false
  TCPENABLED:                    0
  UIMODE:                        Normal
  UpdateEnabled:                 true
  UpdateSource:                  MU
  USEMICROSOFTUPDATE:            false
  X86:                           false

from sqlserverdsc.

johlju avatar johlju commented on May 18, 2024

Hello again @bodunjo! Glad to here you gotten further.

Parameter AGTSVCACCOUNT is assigned the value in $AgtSvcAccountCred, but $AgtSvcAccountCred is never assigned in the configuration. It is assigned outside of the configuration.

If you do the following I think that it should work.

1. Un-comment this row in the $values hash table.

#"AGTSVCACCOUNT=" = $AgtSvcAccountCred;

2. Rename this Configuration parameter on this row

From

[PSCredential]$AgtSvcAccount,

To

[PSCredential]$AgentServiceAccountCredentials,

3. And change this row for the xSQLServerSetup resource.

From

AGTSVCACCOUNT= $AgtSvcAccountCred

To

AGTSVCACCOUNT= $AgentServiceAccountCredentials

from sqlserverdsc.

bodunjo avatar bodunjo commented on May 18, 2024

@johlju Thanks a million. This worked. I had to go through all the available params in the .psm1 files of the DSCResources of the SQLServerSetup.
I managed to install SQLEngine for SQL 2016 without any further issues.
But i realised that the SA account comes disabled. Do you know how i can get this enabled during the installation?

from sqlserverdsc.

randomnote1 avatar randomnote1 commented on May 18, 2024

@bodunjo The SA account is always disabled when using Windows Authentication mode. To get the SA account enabled, you will need to use Mixed Authentication Mode.

from sqlserverdsc.

bodunjo avatar bodunjo commented on May 18, 2024

@randomnote1 Thanks. I never realised that SecurityMode property is available. I've just tested and it works.

from sqlserverdsc.

MagicMarty avatar MagicMarty commented on May 18, 2024

Hi,
Can anyone help me with the following? Getting the following with 8.1.0.0 module while. Any hints?

VM has reported a failure when processing extension 'Microsoft.Powershell.DSC'. Error message: \"DSC Configuration 'Main' completed with error(s). Following are the first few: PowerShell DSC resource MSFT_xSQLServerSetup failed to execute Set-TargetResource functionality with error message: System.Exception: Test-TargetResource returned false after calling Set-TargetResource. The SendConfigurationApply function did not succeed.\"

xSQLServerSetup 'InstallDefaultInstance'
{
InstanceName = 'elasta'
#Features = 'SQLENGINE'
SQLCollation = 'SQL_Latin1_General_CP1_CI_AS'
#[PSCredential] SQLSvcAccount (Write): Service account for the SQL service.
SQLSvcAccount = $SqlInstallCredential
#[PSCredential] AgtSvcAccount (Write): Service account for the SQL Agent service.
AgtSvcAccount = $SqlInstallCredential
#[String[]] SQLSysAdminAccounts (Write): Array of accounts to be made SQL administrators.
SQLSysAdminAccounts = $SqlInstallCredential.UserName
ASSvcAccount = $SqlInstallCredential
ASSysAdminAccounts = $SqlInstallCredential.UserName
InstallSharedDir = 'C:\Program Files\Microsoft SQL Server'
InstallSharedWOWDir = 'C:\Program Files (x86)\Microsoft SQL Server'
InstanceDir = 'C:\Program Files\Microsoft SQL Server'
InstallSQLDataDir = 'M:\SQLData'
SQLUserDBDir = 'M:\SQLData'
SQLUserDBLogDir = 'L:\SQLLogs'
SQLTempDBDir = 'D:'
SQLTempDBLogDir = 'D:'
SQLBackupDir = 'U:\Utilities'
SourcePath = 'C:\SQLServerFull'
UpdateEnabled = 'False'
ForceReboot = $false
PsDscRunAsCredential = $SqlInstallCredential
DependsOn = '[WindowsFeature]NetFramework35', '[WindowsFeature]NetFramework45', '[File]FolderG', '[File]FolderL', '[File]FolderM', '[File]FolderT', '[File]FolderU'
}

Thanks!

from sqlserverdsc.

gdbarron avatar gdbarron commented on May 18, 2024

@MagicMarty From what I've seen, this typically means the setup finished, but not successfully. Have a look at the sql install log which can found at a path similar to "C:\Program Files\Microsoft SQL Server\130\Setup Bootstrap\Log\Summary.txt". (this one is for sql 2016)

from sqlserverdsc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.