In this post we will create a small powershell script to change on a broad scale the snmp configuration of Idrac present on Dell servers, it turns very convenient if you have a battery of tens / hundreds of Idrac to set up as it avoids you to enter every single web interface and losing five minutes for each iDRAC you want to configure.
Firstly you must download from the Dell site and install the package that contains the racadm command, the package is called “Dell OpenManage DRAC Tools” and at this moment the latest version is 8.1.
Enable the unsigned powershell script if you have not already done it with the command:
set-executionpolicy unrestricted
Below you can find the powershell script, so you just need to create a .ps1 file and copy inside of it these lines; Obviously you have to set the parameters in the first lines according to your confgiurazione and IP of your Idrac:
###POWERSHELL CODE
#Insert all the ip addresses in an array
$ Brokerage = @(“10.16.27.223″,”10.16.27.224”)$user = “root”
$password = “Pa$$w0rd”
$ Snmp_dest = “10.16.27.202”
$smtp_server = “mail.domain.com”
$ Mail_dest = “[email protected]”
$snmp_community = “monitoring”$ Dns_server1 = “10.16.27.210”
$ Dns_server2 = “10.16.27.211”
$ntp_server1 = “10.16.27.5”
$ntp_server2 = “10.16.27.6”
foreach ($idrac in $aRAC) {
racadm -r $idrac -u $user -p $password set iDRAC.Tuning.DefaultCredentialWarning Disabled
#DNS Config
write-host “Setup iDrac $idrac DNS…”
racadm -r $idrac -u $user -p $password config -g cfgLanNetworking -o cfgDNSServer1 $dns_server1
racadm -r $idrac -u $user -p $password config -g cfgLanNetworking -o cfgDNSServer2 $dns_server2write-host “Setup iDrac $idrac SNMP…”
racadm -r $idrac -u $user -p $password set idrac.IPMILan.AlertEnable Enabled
racadm -r $idrac -u $user -p $password config -g cfgIpmiPet -o cfgIpmiPetAlertEnable -i 1 1
racadm -r $idrac -u $user -p $password config -g cfgIpmiPet -o cfgIpmiPetAlertDestIPAddr -i 1 $snmp_dest
racadm -r $idrac -u $user -p $password config -g cfgIpmiLan -o cfgIpmiPetCommunityName $snmp_community
racadm -r $idrac -u $user -p $password set iDRAC.SNMP.TrapFormat 1
racadm -r $idrac -u $user -p $password set iDRAC.Snmp.AgentEnable enabled
racadm -r $idrac -u $user -p $password set iDRAC.SNMP.AgentCommunity $snmp_community#Config NTP
write-host “Setup iDrac $idrac NTP…”
racadm -r $idrac -u $user -p $password set idrac.NTPConfigGroup.NTPEnable Enabled
racadm -r $idrac -u $user -p $password set idrac.time.timezone Europe/Rome
racadm -r $idrac -u $user -p $password set idrac.NTPConfigGroup.ntp1 $ntp_server1
racadm -r $idrac -u $user -p $password set idrac.NTPConfigGroup.ntp2 $ntp_server2#write-host “Setup iDrac $idrac SMTP…”
#racadm -r $idrac -u $user -p $password set iDRAC.RemoteHosts.SMTPServerIPAddress $smtp_server
#racadm -r $idrac -u $user -p $password config -g cfgEmailAlert -o cfgEmailAlertEnable -i 1 1
#racadm -r $idrac -u $user -p $password config -g cfgEmailAlert -o cfgEmailAlertAddress -i 1 $mail_dest
}####
P.S.
I left comments on the lines that configure the SMTP part that might still come in handy for alert, to execute them simply remove the comment at the start of the lines.