-
Notifications
You must be signed in to change notification settings - Fork 225
/
1-MakeSureEndpointIsStarted.ps1
60 lines (50 loc) · 2.03 KB
/
1-MakeSureEndpointIsStarted.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
<#
.EXAMPLE
This example will make sure that the endpoint DefaultMirrorEndpoint is in started state in the default instance, if not it will start the endpoint.
.EXAMPLE
This example will make sure that the endpoint HADR is in started state in the default instance, if not it will start the endpoint.
.EXAMPLE
This example will make sure that the endpoint DefaultMirrorEndpoint is in started state in the named instance INSTANCE1, if not it will start the endpoint.
.NOTES
There is three different scenarios in this example to validate the schema during unit testing.
#>
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$SqlAdministratorCredential
)
Import-DscResource -ModuleName SqlServerDsc
node localhost
{
# Start the DefaultMirrorEndpoint in the default instance
SqlServerEndpointState StartEndpoint1
{
ServerName = 'SQLNODE01.company.local'
InstanceName = 'MSSQLSERVER'
Name = 'DefaultMirrorEndpoint'
State = 'Started'
PsDscRunAsCredential = $SqlAdministratorCredential
}
# Start the HADR in the default instance
SqlServerEndpointState StartEndpoint2
{
ServerName = 'SQLNODE01.company.local'
InstanceName = 'MSSQLSERVER'
Name = 'HADR'
State = 'Started'
PsDscRunAsCredential = $SqlAdministratorCredential
}
# Start the DefaultMirrorEndpoint in the named instance INSTANCE1
SqlServerEndpointState StartEndpoint3
{
ServerName = 'SQLNODE01.company.local'
InstanceName = 'INSTANCE1'
Name = 'DefaultMirrorEndpoint'
State = 'Started'
PsDscRunAsCredential = $SqlAdministratorCredential
}
}
}