forked from dsccommunity/SqlServerDsc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path9-UsingSkipRuleDuringInstall.ps1
96 lines (80 loc) · 3.52 KB
/
9-UsingSkipRuleDuringInstall.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<#
.DESCRIPTION
This example shows how to ad skip rules to setup.exe.
.NOTES
Using skip rules is not recommended in a production environment.
#>
Configuration Example
{
[CmdletBinding()]
param
(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.Management.Automation.PSCredential]
$SqlInstallCredential,
[Parameter()]
[ValidateNotNullOrEmpty()]
[System.Management.Automation.PSCredential]
$SqlAdministratorCredential = $SqlInstallCredential,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.Management.Automation.PSCredential]
$SqlServiceCredential,
[Parameter()]
[ValidateNotNullOrEmpty()]
[System.Management.Automation.PSCredential]
$SqlAgentServiceCredential = $SqlServiceCredential
)
Import-DscResource -ModuleName 'xPSDesiredStateConfiguration' -ModuleVersion '9.1.0'
Import-DscResource -ModuleName 'SqlServerDsc'
node localhost
{
#region Install prerequisites for SQL Server
WindowsFeature 'NetFramework35'
{
Name = 'NET-Framework-Core'
Source = '\\fileserver.company.local\images$\Win2k12R2\Sources\Sxs' # Assumes built-in Everyone has read permission to the share and path.
Ensure = 'Present'
}
WindowsFeature 'NetFramework45'
{
Name = 'NET-Framework-45-Core'
Ensure = 'Present'
}
#endregion Install prerequisites for SQL Server
#region Install SQL Server Failover Cluster
SqlSetup 'InstallNamedInstanceNode1-INST2016'
{
Action = 'InstallFailoverCluster'
ForceReboot = $false
UpdateEnabled = 'False'
SourcePath = '\\fileserver.company.local\images$\SQL2016RTM'
SourceCredential = $SqlInstallCredential
InstanceName = 'INST2016'
Features = 'SQLENGINE'
InstallSharedDir = 'C:\Program Files\Microsoft SQL Server'
InstallSharedWOWDir = 'C:\Program Files (x86)\Microsoft SQL Server'
InstanceDir = 'C:\Program Files\Microsoft SQL Server'
SQLCollation = 'Finnish_Swedish_CI_AS'
SQLSvcAccount = $SqlServiceCredential
AgtSvcAccount = $SqlAgentServiceCredential
SQLSysAdminAccounts = 'COMPANY\SQL Administrators', $SqlAdministratorCredential.UserName
# Drive D: must be a shared disk.
InstallSQLDataDir = 'D:\MSSQL\Data'
SQLUserDBDir = 'D:\MSSQL\Data'
SQLUserDBLogDir = 'D:\MSSQL\Log'
SQLTempDBDir = 'D:\MSSQL\Temp'
SQLTempDBLogDir = 'D:\MSSQL\Temp'
SQLBackupDir = 'D:\MSSQL\Backup'
FailoverClusterNetworkName = 'TESTCLU01A'
FailoverClusterIPAddress = '192.168.0.46'
FailoverClusterGroupName = 'TESTCLU01A'
# Not recommended to use in production.
SkipRule = 'Cluster_VerifyForErrors'
PsDscRunAsCredential = $SqlInstallCredential
DependsOn = '[WindowsFeature]NetFramework35', '[WindowsFeature]NetFramework45'
}
#region Install SQL Server Failover Cluster
}
}