Repository navigation
Expand file tree
/
Copy path5.3-SetupServerCore-DSC.ps1
More file actions
76 lines (65 loc) · 2.25 KB
/
Copy path5.3-SetupServerCore-DSC.ps1
File metadata and controls
76 lines (65 loc) · 2.25 KB
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
Configuration SQLServer{
param([string[]] $ComputerName)
Import-DscResource -Module cSQLResources
Import-DscResource -Module xNetworking
Node $ComputerName {
File DataDir{
DestinationPath = 'C:\DBFiles\Data'
Type = 'Directory'
Ensure = 'Present'
}
File LogDir{
DestinationPath = 'C:\DBFiles\Log'
Type = 'Directory'
Ensure = 'Present'
}
File TempDBDir{
DestinationPath = 'C:\DBFiles\TempDB'
Type = 'Directory'
Ensure = 'Present'
}
WindowsFeature NETCore{
Name = 'NET-Framework-Core'
Ensure = 'Present'
IncludeAllSubFeature = $true
Source = 'D:\sources\sxs'
}
WindowsFeature FC{
Name = 'Failover-Clustering'
Ensure = 'Present'
Source = 'D:\source\sxs'
}
xFirewall SQLFW{
Name = 'SQLServer'
DisplayName = 'SQL Server'
Ensure = 'Present'
Access = 'Allow'
Profile = 'Domain'
Direction = 'Inbound'
LocalPort = '1433'
Protocol = 'TCP'
}
xFirewall AGFW{
Name = 'AGEndpoint'
DisplayName = 'Availability Group Endpoint'
Ensure = 'Present'
Access = 'Allow'
Profile = 'Domain'
Direction = 'Inbound'
LocalPort = '5022'
Protocol = 'TCP'
}
cSQLInstall SQLInstall{
InstanceName = 'MSSQLSERVER'
InstallPath = '\\HIKARUDC\InstallFiles\SQLServer\SQL2014'
ConfigPath = '\\HIKARUDC\InstallFiles\SQLServer\SQL2014_Core_DSC.ini'
UpdateEnabled = $true
UpdatePath = '\\HIKARUDC\InstallFiles\SQLServer\SQL2014\Updates'
DependsOn = @("[File]DataDir","[File]LogDir","[File]TempDBDir","[WindowsFeature]NETCore")
}
}
}
cd C:\IntroToPowershell
if(test-path .\SQLServer){ Remove-Item .\SQLServer -Recurse -Force }
SQLServer -ComputerName @('RIKER','PICARD','KIRK','SPOCK')
Start-DscConfiguration .\SQLServer -Wait -Verbose -Force