Home » hp

Tag: hp

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
Set WshNetwork=WScript.CreateObject(“WScript.Network”)
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