The two scripts below are a quick solution to pushing out an identical (except for IP and hostname) configuration to a large number of Dell DRAC boards. They’re not the most efficient and they were written for a specific scenario, but, they should be easy enough to customize. There are two scripts:
- RemoteDracConfig.vbs – This one will take a config template, customize it for a host, and apply it via psexec
- RemoteDracConfigLoop.vbs – This one will read an input CSV and call RemoteDracConfig.vbs for each line
I seperated the scripts specifically so that the first one could easily be used as part of a build process without having to generate an input file for it. To get started, you’ll need to configure a reference DRAC and export its configuration. Once you’ve done the configuration work, run racadm getconfig –f baseline.txt on the reference machine. You’ll next need to replace the machine specific info with tokens. I support two:
- %drac-ip% – this one will get replaced with the IP to use for the DRAC
- %drac-hostname% – this one will get replaced with the hostname to use for the DRAC
cfgDNSRacName=%drac-hostname%-drac
cfgDNSDomainName=domain.com
If you want to do something different, you’ll need to modify the script.
The baseline config also will not have any passwords in it. You’ll need to scroll down to the cfgUserAdmin section and uncomment the # cfgUserAdminPassword=******** (Write-Only) line and replace it with cfgUserAdminPassword=YourPassword. You’ll also need a copy of psexec from Sysinternals. The path to that is hardcoded at the top of RemoteDracConfig.vbs. You’ll need to change this.
Here is RemoteDracConfig.vbs:
'========================================================================== ' NAME: Remote Drac Config ' ' AUTHOR: Brian Desmond, brian@briandesmond.com ' DATE : 11/25/2009 ' ' COMMENT: ' cscript RemoteDracConfig.vbs <targetServer> <targetDracIp> '========================================================================== Option Explicit Const BASE_CONFIG = "baseline.txt" Const PSEXEC_PATH = "z:\tools\sysinternals\psexec.exe" Dim shl Set shl = WScript.CreateObject("WScript.Shell") Dim fso Set fso = WScript.CreateObject("Scripting.FileSystemObject") Dim targetServerName targetServerName = WScript.Arguments(0) Dim targetDracIp targetDracIp = WScript.Arguments(1) Dim baseConfig Set baseConfig = fso.OpenTextFile(BASE_CONFIG) Dim baseConfigStr baseConfigStr = baseConfig.ReadAll baseConfig.Close() baseConfigStr = Replace(baseConfigStr, "%drac-hostname%", targetServerName) baseConfigStr = Replace(baseConfigStr, "%drac-ip%", targetDracIp) If fso.FolderExists("\\" & targetServerName & "\c$\temp") = False Then fso.CreateFolder "\\" & targetServerName & "\c$\temp" End If Dim configOutput Set configOutput = fso.CreateTextFile("\\" & targetServerName & "\c$\temp\dracConfig.txt", True) configOutput.write baseConfigStr configOutput.Close shl.Run PSEXEC_PATH & " \\"& targetServerName & " racadm config -f c:\temp\dracconfig.txt -p", 1, True shl.Run PSEXEC_PATH & " \\"& targetServerName & " racadm racreset", 1, True fso.DeleteFile "\\" & targetServerName & "\c$\temp\dracConfig.txt", True
Here is RemoteDracConfigLoop.vbs:
'========================================================================== ' NAME: Drac Config Loop ' ' AUTHOR: Brian Desmond, brian@briandesmond.com ' DATE : 11/25/2009 ' ' COMMENT: ' '========================================================================== ' Input File Format ' DracIp,ServerNbtName ' Example: ' 10.10.10.102,srv1 ' 10.10.10.104,srv2 Option Explicit Const INPUT_FILE = "input.txt" Dim shl Set shl = WScript.CreateObject("WScript.Shell") Dim fso Set fso = WScript.CreateObject("Scripting.FileSystemObject") Dim inputFile Set inputFile = fso.OpenTextFile(INPUT_FILE) Dim line Dim tokens While Not inputFile.AtEndOfStream line = inputFile.ReadLine tokens = Split(line, ",") WScript.Echo tokens(1) shl.Run "cscript RemoteDracConfig.vbs " & tokens(1) & " " & tokens(0), 1, True Wend inputFile.Close()
I tested this against several Windows Server 2008 x64 and Windows Server 2008 R2 machines equipped with DRAC5 boards and it worked well. YMMV of course. The racadm tool ships with the Dell OpenManage Server Administrator components so you’ll need those installed on each machine in order for this to work.