-
Notifications
You must be signed in to change notification settings - Fork 225
/
4-CompleteWithTwoInstances.ps1
139 lines (116 loc) · 4.81 KB
/
4-CompleteWithTwoInstances.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<#
.EXAMPLE
This example installs to instances where the first named instance is used for
the Reporting Services databases, and the second named instance is used for
Reporting Services. After installing the two instances, the configuration
performs a default SQL Server Reporting Services configuration. It will
initialize SQL Server Reporting Services and register the default
Report Server Web Service and Report Manager URLs:
Report Manager: http://localhost:80/Reports_RS
Report Server Web Service: http://localhost:80/ReportServer_RS
#>
$ConfigurationData = @{
AllNodes = @(
@{
NodeName = 'localhost'
# This is values used for the Reporting Services instance.
InstanceName = 'RS'
Features = 'RS'
# This is values used for the Database Engine instance.
DatabaseServerName = $env:COMPUTERNAME
DatabaseServerInstanceName = 'RSDB'
DatabaseServerFeatures = 'SQLENGINE'
DatabaseServerCollation = 'Finnish_Swedish_CI_AS'
# This is values used for both instances.
MediaPath = 'Z:\Sql2016Media'
InstallSharedDir = 'C:\Program Files\Microsoft SQL Server'
InstallSharedWOWDir = 'C:\Program Files (x86)\Microsoft SQL Server'
UpdateEnabled = 'False'
BrowserSvcStartupType = 'Automatic'
}
)
}
Configuration Example
{
[CmdletBinding()]
param
(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.Management.Automation.PSCredential]
$SqlAdministratorCredential,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.Management.Automation.PSCredential]
$SqlInstallCredential,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.Management.Automation.PSCredential]
$SqlServiceCredential,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.Management.Automation.PSCredential]
$SqlAgentServiceCredential,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.Management.Automation.PSCredential]
$ReportingServicesServiceCredential
)
Import-DscResource -ModuleName PSDscResources
Import-DscResource -ModuleName SqlServerDsc
Node localhost {
WindowsFeature 'NetFramework45'
{
Name = 'NET-Framework-45-Core'
Ensure = 'Present'
}
SqlSetup 'InstallDatabaseEngine'
{
InstanceName = $Node.DatabaseServerInstanceName
Features = $Node.DatabaseServerFeatures
SourcePath = $Node.MediaPath
BrowserSvcStartupType = $Node.BrowserSvcStartupType
SQLCollation = $Node.DatabaseServerCollation
SQLSvcAccount = $SqlServiceCredential
AgtSvcAccount = $SqlAgentServiceCredential
InstallSharedDir = $Node.InstallSharedDir
InstallSharedWOWDir = $Node.InstallSharedWOWDir
UpdateEnabled = $Node.UpdateEnabled
SQLSysAdminAccounts = @(
$SqlAdministratorCredential.UserName
)
PsDscRunAsCredential = $SqlInstallCredential
DependsOn = @(
'[WindowsFeature]NetFramework45'
)
}
SqlSetup 'InstallReportingServicesInstance'
{
InstanceName = $Node.InstanceName
Features = $Node.Features
SourcePath = $Node.MediaPath
BrowserSvcStartupType = $Node.BrowserSvcStartupType
RSSvcAccount = $ReportingServicesServiceCredential
InstallSharedDir = $Node.InstallSharedDir
InstallSharedWOWDir = $Node.InstallSharedWOWDir
UpdateEnabled = $Node.UpdateEnabled
PsDscRunAsCredential = $SqlInstallCredential
DependsOn = @(
'[WindowsFeature]NetFramework45'
'[SqlSetup]InstallDatabaseEngine'
)
}
SqlRS 'ConfigureReportingServiceInstance'
{
# Instance name for the Reporting Services.
InstanceName = $Node.InstanceName
# Instance for Reporting Services databases.
DatabaseServerName = $Node.DatabaseServerName
DatabaseInstanceName = $Node.DatabaseServerInstanceName
PsDscRunAsCredential = $SqlInstallCredential
DependsOn = @(
'[SqlSetup]InstallReportingServicesInstance'
)
}
}
}