Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Configuration SQLInstall
- {param (
- [Parameter(Mandatory=$true)]
- [ValidateNotNullOrEmpty()]
- [String]
- $PackagePath,
- [Parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $ServiceAccountCredential
- )
- Import-DscResource –ModuleName PSDesiredStateConfiguration
- Import-DSCResource -ModuleName ComputerManagementDsc
- Import-DSCResource -ModuleName SqlServerDsc
- Node $AllNodes.where{ $_.Role.Contains("SQLENGINE") }.NodeName
- {
- Log ParamLog
- {
- Message = "Running SQLInstall. PackagePath = $PackagePath"
- }
- # Password info here
- $password = $using:Node.Service4SQLPassword | ConvertTo-SecureString -asPlainText -Force
- $username = $using:Node.Service4SQLAccount
- $Credential = New-Object System.Management.Automation.PSCredential($username,$password)
- SqlServiceAccount SetServiceAccount_DatabaseEngine
- {
- ServerName = $Node.NodeName
- InstanceName = 'MSSQLSERVER'
- ServiceType = 'DatabaseEngine'
- ServiceAccount = $ServiceAccountCredential
- RestartService = $true
- Force = $true
- DependsOn = "[Script]InstallSQLServer"
- }
- SqlServiceAccount SetServiceAccount_SQLServerAgent
- {
- ServerName = $Node.NodeName
- InstanceName = 'MSSQLSERVER'
- ServiceType = 'SQLServerAgent'
- ServiceAccount = $ServiceAccountCredential
- RestartService = $true
- Force = $true
- DependsOn = "[Script]InstallSQLServer"
- }
- SqlServiceAccount SetServiceAccount_IntegrationServices
- {
- ServerName = $Node.NodeName
- InstanceName = 'MSSQLSERVER'
- ServiceType = 'IntegrationServices'
- ServiceAccount = $ServiceAccountCredential
- RestartService = $true
- Force = $true
- DependsOn = "[Script]InstallSQLServer"
- }
- }}
- SQLInstall -ConfigurationData C:PowerShell_UserScriptsMyServerData.psd1 `
Add Comment
Please, Sign In to add comment