Home » KBArticles » Script to interrogate HP Servers serial and add ilo alias to DNS

Script to interrogate HP Servers serial and add ilo alias to DNS

‘ Section to interrogate the servers Serial number, trim the spaces then call dnscmd.exe to add the ilo%servername% as an alias to ilo%serialnumber%

strComputer = “.”
Set objWMIService = GetObject(“winmgmts:” _
& “{impersonationLevel=impersonate}!\” & strComputer & “rootcimv2”)
Set colBIOS = objWMIService.ExecQuery _
(“Select * from Win32_BIOS”)
For each objBIOS in colBIOS
strSerial = objBIOS.SerialNumber
Next
Set WshNetwork=WScript.CreateObject(“WScript.Network”)
COMPUTERNAME=WshNetwork.ComputerName
set dShell=createobject(“wscript.shell”)
dshell.run “c:dnscmd.exe DNSSERVER /RecordAdd mydomain.com ilo”& COMPUTERNAME &” CNAME ilo”& TRIM(strSerial) & “.mydomain.com”
set oShell=nothing

Leave a Reply

Your email address will not be published.

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