I'm in the process of moving our director to a new system and needed to update the bacula-fd.conf on all our Windows client PCs to use the new name. This VBScript function can be inserted into your domain login script and customised to suit your setup.
Sending around an E-Mail telling people to logout and login is a lot easier than trying to explain a simple text replace to non-technical staff :) Note for people considering rolling out Bacula: Setup a CNAME (DNS alias) like baculadir.office.example.com which points at your server and use that in your configuration files. If I had done that when I started I would not have needed to write this script at all. Cheers, Dominic CONST EXISTING_DIRECTOR = "aserver" CONST NEW_DIRECTOR = "baculadir" CONST BACULA_FD_CONF_PATH = "c:\bacula\bin\bacula-fd.conf" CONST FSO_FOR_READING = 1 CONST FSO_FOR_WRITING = 2 Dim BACULA_FD_CONF_BACKUP BACULA_FD_CONF_BACKUP = BACULA_FD_CONF_PATH & ".bak" Function UpdateFileDaemonConfig Dim oFSO, oCNF, TXT Set oFSO = CreateObject("Scripting.FileSystemObject") UpdateFileDaemonConfig = False If Not oFSO.FileExists(BACULA_FD_CONF_BACKUP) Then If oFSO.FileExists(BACULA_FD_CONF_PATH) Then oFSO.CopyFile BACULA_FD_CONF_PATH, BACULA_FD_CONF_BACKUP If oFSO.FileExists(BACULA_FD_CONF_BACKUP) Then Set oCNF = oFSO.OpenTextFile(BACULA_FD_CONF_PATH, FSO_FOR_READING) TXT = Replace(oCNF.ReadAll, EXISTING_DIRECTOR, NEW_DIRECTOR) oCNF.Close Set oCNF = oFSO.OpenTextFile(BACULA_FD_CONF_PATH, FSO_FOR_WRITING) oCNF.Write TXT oCNF.Close UpdateFileDaemonConfig = True End If End If End If Set oFSO = Nothing End Function UpdateFileDaemonConfig ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642 _______________________________________________ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users