1
+ <#
2
+ Copyright 2017 Dominique Broeglin
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ #>
16
+
17
+ function Enable-NSHighAvailability {
18
+ <#
19
+ . SYNOPSIS
20
+ Enable high-availability between two NetScaler instances.
21
+
22
+ . DESCRIPTION
23
+ Enable high-availability between two NetScaler instances.
24
+
25
+ . EXAMPLE
26
+ Enable-NSHighAvailability -PrimarySession $ns1 -SecondarySession Session $ns2
27
+
28
+ Enable high-availability between the netscaler instances corresponding to
29
+ the already opened $ns1 and $ns2.
30
+
31
+ . PARAMETER PrimarySession
32
+ The NetScaler session object for the first NetScaler instance (will end up master).
33
+
34
+ . PARAMETER SecondarySession
35
+ The NetScaler session object for the second NetScaler instance (will end up slave).
36
+
37
+ . PARAMETER PeerNodeId
38
+ The node id used to denote the peer.
39
+
40
+ Default value: 1
41
+
42
+ . PARAMETER Force
43
+ Suppress confirmation when activating high-availability.
44
+ #>
45
+ [CmdletBinding (SupportsShouldProcess = $true , ConfirmImpact = ' High' )]
46
+ param (
47
+ [parameter (Mandatory )]
48
+ $PrimarySession ,
49
+
50
+ [parameter (Mandatory )]
51
+ $SecondarySession ,
52
+
53
+ [int ]$PeerNodeId = 1 ,
54
+
55
+ [switch ]$Force
56
+ )
57
+
58
+ begin {
59
+ _AssertSessionActive - Session $PrimarySession
60
+ _AssertSessionActive - Session $SecondarySession
61
+ }
62
+
63
+ process {
64
+ if ($Force -or $PSCmdlet.ShouldProcess ($item , ' Enable high-availability' )) {
65
+ try {
66
+
67
+
68
+ } catch {
69
+ throw $_
70
+ }
71
+ }
72
+ }
73
+ }
0 commit comments