{"id":841,"date":"2018-03-05T17:22:05","date_gmt":"2018-03-05T17:22:05","guid":{"rendered":"http:\/\/ihni.uk\/?p=841"},"modified":"2018-03-05T17:22:05","modified_gmt":"2018-03-05T17:22:05","slug":"remotely-setting-kemp-nlb-dns-settings","status":"publish","type":"post","link":"https:\/\/ihni.uk\/?p=841","title":{"rendered":"Remotely setting Kemp NLB DNS Settings"},"content":{"rendered":"<p>This script requires the Kemp PowerShell modules to be downloaded from Kemps support site.<br \/>\nAt the time of writing these were still in a beta stage.<!--more--><\/p>\n<p>[cc lang=&#8221;Powershell&#8221;]<\/p>\n<p>##################################################<br \/>\n#<br \/>\n#\u00a0 PowerShell Script to Get and change the DNS<br \/>\n#\u00a0 Kemp NLB to facilitate new DNS servers<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 NO&#8217;K<br \/>\n#\u00a0 _\u00a0 ________ __\u00a0 __ _____\u00a0\u00a0\u00a0 _____\u00a0 _\u00a0\u00a0 _\u00a0 _____<br \/>\n# | |\/ \/\u00a0 ____|\u00a0 \\\/\u00a0 |\u00a0 __ \\\u00a0 |\u00a0 __ \\| \\ | |\/ ____|<br \/>\n# | &#8216; \/| |__\u00a0 | \\\u00a0 \/ | |__) | | |\u00a0 | |\u00a0 \\| | (___<br \/>\n# |\u00a0 &lt; |\u00a0 __| | |\\\/| |\u00a0 ___\/\u00a0 | |\u00a0 | | . ` |\\___ \\<br \/>\n# | . \\| |____| |\u00a0 | | |\u00a0\u00a0\u00a0\u00a0\u00a0 | |__| | |\\\u00a0 |____) |<br \/>\n# |_|\\_\\______|_|\u00a0 |_|_|\u00a0\u00a0\u00a0\u00a0\u00a0 |_____\/|_| \\_|_____\/<br \/>\n#<br \/>\n##################################################<\/p>\n<p>$ModuleLoc = &#8220;C:\\Kemp.LoadBalancer.Powershell.psm1&#8221;<br \/>\n$LoadMasters = (Get-Content &#8216;C:\\nlbs.txt&#8217;)<\/p>\n<p>$onlinelist = @()<br \/>\n$offlinelist = @()<br \/>\n$oldDNS = @()<br \/>\n$newDNS = &#8216;1.1.1.1,2.2.2.2&#8217;<\/p>\n<p>$creds = Get-Credential<\/p>\n<p>Import-Module $ModuleLoc<\/p>\n<p>$LoadMasters|%{if(Test-Connection $_ -Quiet -Count 2){<br \/>\nWrite-Verbose &#8220;`t $_ is up&#8221;; $onlinelist += $_}<br \/>\nelse{Write-Warning &#8220;`t`t`t`t $_ is not contactable&#8221;; $offlinelist += $_}<br \/>\n}<br \/>\nif($offlinelist -ne $null){<br \/>\n$ofs=&#8221;,&#8221;; $offl #\u00a0\u00a0 Write-Verbose &#8220;Checking Connection to $kemp&#8221;<br \/>\n$OfflineMsg=&#8221;The following Kemps are offline: $offlinelist&#8221;;$ofs=&#8221; &#8220;}<br \/>\n$onlinelist|%{<br \/>\n#Write-Host &#8220;Initilizing Connection to $kemp&#8221; -backgroundcolor yellow<br \/>\nInitialize-LoadBalancer -Address $_ -LBPort 443 -Credential $creds}<\/p>\n<p>$outfileA = $onlinelist|%{Get-DNSConfiguration -LoadBalancer $_ | Select &#8216;HA1Hostname&#8217;, &#8216;HA2Hostname&#8217;, &#8216;NamServer&#8217;}<br \/>\n$outfileA | Out-File &#8216;C:\\KempDNS.txt&#8217;<\/p>\n<p>$outfileB = $onlinelist|%{Set-DNSConfiguration -LoadBalancer $_ -NameServer $newDNS }<br \/>\n$outfileB | Select &#8216;HA1Hostname&#8217;, &#8216;HA2Hostname&#8217;, &#8216;NamServer&#8217;| Out-File &#8216;C:\\KempnewDNS.txt&#8217;<\/p>\n<p>[\/cc]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This script requires the Kemp PowerShell modules to be downloaded from Kemps support site. At&hellip;<\/p>\n","protected":false},"author":1,"featured_media":988,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[19,11],"tags":[49,59],"class_list":["post-841","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","category-scripts","tag-kemp-industries","tag-nlb"],"jetpack_featured_media_url":"https:\/\/ihni.uk\/wp-content\/uploads\/2020\/02\/Powershell.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ihni.uk\/index.php?rest_route=\/wp\/v2\/posts\/841","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ihni.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ihni.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ihni.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ihni.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=841"}],"version-history":[{"count":0,"href":"https:\/\/ihni.uk\/index.php?rest_route=\/wp\/v2\/posts\/841\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ihni.uk\/index.php?rest_route=\/wp\/v2\/media\/988"}],"wp:attachment":[{"href":"https:\/\/ihni.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=841"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ihni.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=841"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ihni.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=841"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}