3
3
Configuration SQLStandalone
4
4
{
5
5
param (
6
- [pscredential ]$SetupCredential # # Need to pass a credential for setup
6
+ [Parameter (Mandatory )]
7
+ [ValidateNotNullOrEmpty ()]
8
+ [pscredential ]$SetupCredential ,
9
+
10
+ [Parameter (Mandatory )]
11
+ [ValidateNotNullOrEmpty ()]
12
+ [ValidatePattern (' sxs$' )]
13
+ [string ]$WindowsServerSource ,
14
+
15
+ [Parameter (Mandatory )]
16
+ [ValidateNotNullOrEmpty ()]
17
+ [string ]$SqlServerInstallSource ,
18
+
19
+ [Parameter (Mandatory )]
20
+ [ValidateNotNullOrEmpty ()]
21
+ [string ]$SysAdminAccount
7
22
)
8
23
# # Download the xSQLServer module from the PowerShell Gallery
9
24
Import-DscResource - Module xSQLServer
@@ -16,26 +31,26 @@ Configuration SQLStandalone
16
31
{
17
32
Ensure = " Present"
18
33
Name = " NET-Framework-Core"
19
- Source = " \MEMBERSRV1InstallersWindowsServer2012R2sourcessxs "
34
+ Source = $WindowsServerSource
20
35
}
21
36
22
37
# # Have DSC grab install bits from the SourcePath, install under the instance name with the features
23
38
# # using the specified SQL Sys admin accounts. Be sure to install the Windows feature first.
24
39
xSqlServerSetup ' SqlServerSetup'
25
40
{
26
41
DependsOn = " [WindowsFeature]NET-Framework-Core"
27
- SourcePath = ' \MEMBERSRV1InstallersSqlServer2016 '
42
+ SourcePath = $SqlServerInstallSource
28
43
SetupCredential = $SetupCredential
29
44
InstanceName = ' MSSQLSERVER'
30
45
Features = ' SQLENGINE,FULLTEXT,RS,AS,IS'
31
- SQLSysAdminAccounts = ' mylab.localAdministrator '
46
+ SQLSysAdminAccounts = $SysAdminAccount
32
47
}
33
48
34
49
# # Add firewall exceptions for SQL Server but run SQL server setup first.
35
50
xSqlServerFirewall ' SqlFirewall'
36
51
{
37
52
DependsOn = ' [xSqlServerSetup]SqlServerSetup'
38
- SourcePath = ' \MEMBERSRV1InstallersSqlServer2016 '
53
+ SourcePath = $SqlServerInstallSource
39
54
InstanceName = ' MSSQLSERVER'
40
55
Features = ' SQLENGINE,FULLTEXT,RS,AS,IS'
41
56
}
@@ -46,5 +61,5 @@ if (-not (Get-Module -Name xSqlServer -ListAvailable)) {
46
61
Install-Module - Name ' xSqlServer' - Confirm:$false
47
62
}
48
63
49
- SQLStandAlone
64
+ SQLStandAlone - SetupCredential ( Get-Credential ) - WindowServerSource ' ' - SqlServerInstallSource ' ' - SysAdminAccount ' ' - ConfigurationData ' .\ConfiguraitonData.psd1 '
50
65
Start-DscConfiguration –Wait –Force –Path ' .\SQLStandalone' –Verbose
0 commit comments