Configure Windows DNS for HCP 7 with PowerShell Script

The new Hitachi Content Platform version 7 is out and it is packed with several new features and enhancements. One of the new features is the DNS functionality. The new built-in DNS services drop the dependency on external DNS servers for DNS queries for the Tenants or namespace.  The way to configure DNS in HCP 7 is by configuring a secondary DNS zone in the Windows servers and referring to the HCP nodes as the Primary Zone masters.

I decided to automate the process to help with the installation and configuration of the HCP into a customer environment. The video goes thru the process of executing the PowerShell script that will configure everything needed for a new HCP 7 setup.

[youtubegallery]


[/youtubegallery]

[code language = ps]

##########################################################
# ScriptName: Configure-DNS-Zone-HCP7.ps1
# Author: Carlos Vargas
# Contact: carlos dot vargas at hds dot com
# Info: This script will configure the HCP DNS zone in
#       a Windows DNS server
# Version: 1
#########################################################

# Script to create DNS records for HCP 7

cls
Write-Host “”
Write-Host “HCP 7 DNS Zone Configuration Script for Windows” -ForegroundColor Yellow
Write-Host “Version 1.0” -ForegroundColor Yellow

# ——————- Functions ———————–

Function GetDNSZones(){

$PrimaryDNSZones = Get-DNSServerZone | Where-Object ZoneType -like “*primary*” | Where-Object IsReverseLookupZone -like  “False” | Where-Object ZoneName -notlike “TrustAnchors”
$DNSZonesCount = $PrimaryDNSZones.count

For($i = 0;$i -le ($PrimaryDNSZones.count – 1);$i++)
{
$x = $i + 1
Write-Host “$x.” $PrimaryDNSZones[$i].ZoneName
}

Write-Host””
$DNSZoneSelection = Read-Host -Prompt “Select Option 1 – $DNSZonesCount”
$DNSZone = $PrimaryDNSZones[$DNSZoneSelection – 1].ZoneName
$DNSZone
}

# —————- End Functions —————————-

# —————- Body ————————————-

# Select DNS Zone for HCP nodes A Records
Write-Host “”
Write-Host “Please Select the DNS Zone where you want to create your HCP Nodes A Records” -ForegroundColor Yellow
$SelectedDNSZone = GetDNSZones

# Collect Information about HCP Nodes
Write-Host “”
$hcpnodeminip = Read-Host “Type the IP Address of your first HCP Node. Ex: 192.168.2.10”
$hcpdnsservername = Read-Host “Type the Host name to use as reference for the HCP node. Ex: hcp-node-001”

# Create HCP-Nodes in DNS to reference secondary zone from HCP
Add-DnsServerResourceRecordA -Name $hcpdnsservername -ZoneName $SelectedDNSZone -IPv4Address $hcpnodeminip

# Validate Record Created
#Get-DnsServerResourceRecord -Name $hcpdnsservername -ZoneName $SelectedDNSZone

# Create Secondary Zone pointing to HCP nodes
$hcpdnszonename = Read-Host “Type the name of the HCP cluster DNS zone. Ex: hcp7.domain.com”
$hcpdnszonefile = “$hcpdnszonename.dns”
Add-DnsServerSecondaryZone -name $hcpdnszonename -ZoneFile $hcpdnszonefile -MasterServers $hcpnodeminip

# Open HCP Admin Portal via new DNS Zone name
$hcpadminportalurl = “https://admin.$hcpdnszonename”+”:8000″
Start-Process $hcpadminportalurl

#——————– End Body —————————————————-

[/code]

Let me know what do you think.

Carlos

Subscribe For Latest Updates

Sign up for best of digital marketing, livestream and technology opinions on what matters to you.

Invalid email address
We promise not to spam you. You can unsubscribe at any time.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: