Creating and enabling the HADR endpoint
In this recipe, we will create and enable the AlwaysOn endpoint for all the nodes.
Getting ready
For this recipe, we will use port 5022 for the AlwaysOn communication for all the nodes. To ensure that this works, an exception in the firewall needs to be created for this port for all the instances. If you are using an isolated development environment, you need to first turn off the firewall to get this recipe to work, without having to tinker with the firewall.
We are also going to execute the code on all the nodes. For the following recipe to work, PSRemoting
needs to be turned on in every node. Log in to each of the nodes, launch PowerShell or PowerShell ISE as an administrator, and enable remoting using the following script:
Enable-PSRemoting -Force
How to do it...
The following steps will create and enable the AlwaysOn endpoint:
- Open PowerShell ISE as an administrator.
- Add the following script and run it:
#prompt for credential $cred = Get-Credential ...