{"id":839,"date":"2018-03-05T17:14:41","date_gmt":"2018-03-05T17:14:41","guid":{"rendered":"http:\/\/ihni.uk\/?p=839"},"modified":"2018-03-05T17:14:41","modified_gmt":"2018-03-05T17:14:41","slug":"remotely-setting-hp-ilo-dns-settings","status":"publish","type":"post","link":"https:\/\/ihni.uk\/?p=839","title":{"rendered":"Remotely Setting HP ILO DNS Settings"},"content":{"rendered":"<p>This script requires a module to be downloaded from the HP site for some of the commandlets to run.<\/p>\n<p><!--more-->[cc lang=&#8221;powershell&#8221;]<\/p>\n<p>############################################################<br \/>\n#<br \/>\n# Set DNS Settings on Multiple HP ILOs<br \/>\n#<br \/>\n# NOK &#8211; Oct15<br \/>\n#\u00a0 _\u00a0\u00a0\u00a0 _ _____\u00a0\u00a0\u00a0 _____ _\u00a0\u00a0\u00a0\u00a0\u00a0 ____\u00a0\u00a0\u00a0 _____\u00a0 _\u00a0\u00a0 _\u00a0 _____<br \/>\n# | |\u00a0 | |\u00a0 __ \\\u00a0 |_\u00a0\u00a0 _| |\u00a0\u00a0\u00a0 \/ __ \\\u00a0 |\u00a0 __ \\| \\ | |\/ ____|<br \/>\n# | |__| | |__) |\u00a0\u00a0 | | | |\u00a0\u00a0 | |\u00a0 | | | |\u00a0 | |\u00a0 \\| | (___<br \/>\n# |\u00a0 __\u00a0 |\u00a0 ___\/\u00a0\u00a0\u00a0 | | | |\u00a0\u00a0 | |\u00a0 | | | |\u00a0 | | . ` |\\___ \\<br \/>\n# | |\u00a0 | | |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 _| |_| |___| |__| | | |__| | |\\\u00a0 |____) |<br \/>\n# |_|\u00a0 |_|_|\u00a0\u00a0\u00a0\u00a0\u00a0 |_____|______\\____\/\u00a0 |_____\/|_| \\_|_____\/<br \/>\n#<br \/>\n############################################################<\/p>\n<p>$password = ConvertTo-SecureString -String &#8216;ILOPASSWORD&#8217; -AsPlainText -Force<br \/>\n$creds = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList (&#8216;Administrator&#8217;, $password)<br \/>\n$ilos = Get-Content(&#8216;c:\\AllIlos.txt&#8217;)<\/p>\n<p># Get current DNS Settings for ILOs<br \/>\n$getDNS = @()<br \/>\nForEach ($ilo in $ilos){<br \/>\n$GetDNS += Get-HPiLONetworkSetting -Server $ilo -Credential $creds | select HOSTNAME, PRIM_DNS_SERVER, SEC_DNS_SERVER<br \/>\n}<\/p>\n<p>$getDNS &gt; &#8216;C:\\HPILODNS.txt&#8217;<\/p>\n<p># Set new DNS on ILOs<\/p>\n<p>$getNewDNS = @()<br \/>\nForEach ($ilo in $ilos){<br \/>\nWrite-Host &#8220;Setting $ilo DNS&#8230;&#8221;<br \/>\nSet-HPiLONetworkSetting -server $ilo -PrimDNSServer &#8216;DNS SERVER 1 IP&#8217; -SecDNSServer &#8216;DNS SERVER 2 IP&#8217; -Credential $creds -EA SilentlyContinue<br \/>\n$GetNewDNS += Get-HPiLONetworkSetting -Server $ilo -Credential $creds | select HOSTNAME, PRIM_DNS_SERVER, SEC_DNS_SERVER, TER_DNS_SERVER<br \/>\n}<\/p>\n<p>$getNewDNS &gt; &#8216;C:\\HPILOResults.txt&#8217;<\/p>\n<p>[\/cc]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This script requires a module to be downloaded from the HP site for some of&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":[44,48],"class_list":["post-839","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","category-scripts","tag-hp","tag-ilo"],"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\/839","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=839"}],"version-history":[{"count":0,"href":"https:\/\/ihni.uk\/index.php?rest_route=\/wp\/v2\/posts\/839\/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=839"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ihni.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=839"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ihni.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=839"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}