1
+ # requires -Version 5
2
+
3
+ Configuration SQLStandalone
4
+ {
5
+ param (
6
+ [pscredential ]$SetupCredential # # Need to pass a credential for setup
7
+ )
8
+ # # Download the xSQLServer module from the PowerShell Gallery
9
+ Import-DscResource - Module xSQLServer
10
+
11
+ # # Run this DSC configuration on the localhost (gathered from configuration data)
12
+ Node $AllNodes.NodeName
13
+ {
14
+ # # Install a prerequisite Windows feature
15
+ WindowsFeature " NET-Framework-Core"
16
+ {
17
+ Ensure = " Present"
18
+ Name = " NET-Framework-Core"
19
+ Source = " \MEMBERSRV1InstallersWindowsServer2012R2sourcessxs"
20
+ }
21
+
22
+ # # Have DSC grab install bits from the SourcePath, install under the instance name with the features
23
+ # # using the specified SQL Sys admin accounts. Be sure to install the Windows feature first.
24
+ xSqlServerSetup ' SqlServerSetup'
25
+ {
26
+ DependsOn = " [WindowsFeature]NET-Framework-Core"
27
+ SourcePath = ' \MEMBERSRV1InstallersSqlServer2016'
28
+ SetupCredential = $SetupCredential
29
+ InstanceName = ' MSSQLSERVER'
30
+ Features = ' SQLENGINE,FULLTEXT,RS,AS,IS'
31
+ SQLSysAdminAccounts = ' mylab.localAdministrator'
32
+ }
33
+
34
+ # # Add firewall exceptions for SQL Server but run SQL server setup first.
35
+ xSqlServerFirewall ' SqlFirewall'
36
+ {
37
+ DependsOn = ' [xSqlServerSetup]SqlServerSetup'
38
+ SourcePath = ' \MEMBERSRV1InstallersSqlServer2016'
39
+ InstanceName = ' MSSQLSERVER'
40
+ Features = ' SQLENGINE,FULLTEXT,RS,AS,IS'
41
+ }
42
+ }
43
+ }
44
+
45
+ if (-not (Get-Module - Name xSqlServer - ListAvailable)) {
46
+ Install-Module - Name ' xSqlServer' - Confirm:$false
47
+ }
48
+
49
+ SQLStandAlone
50
+ Start-DscConfiguration –Wait –Force –Path ' .\SQLStandalone' –Verbose
0 commit comments