#157363 - 2006-02-17 12:57 AM
Backup certain Lotus Notes client files
|
Les
KiX Master
   
Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
|
We run a Lotus Notes shop where the client files are all on the local C: drive and we don't backup users' local drives. Lately, we've had a bad run of hard drive failures and our users are really getting pissed off about losing their personal address books, links, desktops, settings, etc.
Someone came up with the bright idea that we could backup key files periodically. I figured that a Notes agent on the client should be able to do it but my Notes administrator declined, so then that means a logon script.
At first blush, it sounds faily straight forward but we have every version of the client between 6.0.x and 6.5.4, both single and multi user, and variations on the options. The problem is that each permutation stores files in different places and I cannot find the path to all of them in the same place. Some versions, I can find the path to the notes.ini file in the reg, but I found some installs that did not. If I can find the INI, I can then pull the data path from it and extrapolate the full paths to the file.
I thought I had the basic outline pegged well enough to run a limited trial. The fist two machines (my boss and the Notes admin) I tested had the administration components installed and lacked the reg key that held the INI file value.
Are there any Notes experts out there that can look over my beginnings of test code and advise? Code:
Break On Dim $RC, $LastRun, $CurCTime, $CABFile, $IsNotesInstalled Dim $Index, $NotesIniPath, $Directory Dim $KeyFilename, $FileNames[8], $File $RC = SetOption('WrapAtEOL','On') ;for testing only, comment out for production $RC = SetOption('Explicit','On') $RC = SetOption('NoVarsInStrings','On')
/* Start Block comment The script checks for LastRun and only runs if LastRun is more than one week old. One week in CTime = 604800 LastRun Saved in CTime format to: HKCU\Software\KiXtart\Weekly LastRun e.g. "1139417456" = 2006/02/08 10:50:56 TZ -6 Note that it will still flag the registry even if there are no Notes files found to backup. It is simply a matter of efficiency, being quicker to check LastRun than enumerate whether Notes files exist which is done further down in the script.
The action of the remaining script is to backup key files to a compressed CAB file. It must run at logon and has to complete before Notes throws a lock on any of the files. If it encounters a locked file, it will quit prematurely with no CAB file created. For that very reason, do NOT place unrelated code after the MakeCAB($CABFile,$FileNames) line. End Block comment */
$LastRun = ReadValue('HKCU\Software\KiXtart\Weekly','LastRun') $CurCTime = FlipCTime(@Date,@Time,-6) ;If Val($CurCTime) - Val($LastRun) > 604800 ;uncomment for production If 1 ;for testing only - runs it every time - remove for production $RC = WriteValue('HKCU\Software\KiXtart\Weekly','LastRun',$CurCTime,'REG_SZ')
/* Start Block comment The script first checks "App Paths" to see if Notes is installed. The script then locates the notes.ini file from the following reg Key/Value: HKCU\Software\Lotus\Notes\6.0 NotesIniPath e.g. "C:\Documents and Settings\LLigetfa\Local Settings\Application Data\Lotus\Notes\Data\notes.ini"
That method only works on regular client installs. Administrator installs lack the \6.0 reg key.
The script then reads the INI file for the following Keys/Values: [Notes] Directory= e.g. "C:\Documents and Settings\LLigetfa\Local Settings\Application Data\Lotus\Notes\Data"
KeyFilename= e.g. "lligetfa.id"
The first element, initially '' is a placeholder for <yourname>.ID This could get tricky as it can exist in different locations. The remaining elements are as follows. End Block comment */ $IsNotesInstalled = ReadValue('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\notes.exe','Path') If Exist('O:') And $IsNotesInstalled <> '' $CABFile = 'O:\do_NOT_use\' + @WKSTA + '.cab' If Exist($CABFile) Del $CABFile EndIf
$NotesIniPath = ReadValue('HKCU\Software\Lotus\Notes\6.0','NotesIniPath') $Directory = ReadProfileString($NotesIniPath,'Notes','Directory') If $Directory <> '' And $NotesIniPath <> '' $FileNames = '', 'BOOKMARK.NSF', 'BUSYTIME.NSF', 'DESKTOP6.NDK', 'HEADLINE.NSF', 'NAMES.NSF', 'NOTES.INI', 'PERWEB.NSF', 'USER.DIC' $KeyFilename = ReadProfileString($NotesIniPath,'Notes','KeyFilename') If InStr($KeyFilename,'\') $FileNames[0] = $KeyFilename Else $FileNames[0] = $Directory + '\' + $KeyFilename ;This requires further testing EndIf If Exist($FileNames[0]) ;filenames previously saved to an array, now have the $Directory +'\' prepended. For $Index = 1 to Ubound($FileNames) If Exist($Directory + '\' + $FileNames[$Index]) $FileNames[$Index] = $Directory + '\' + $FileNames[$Index] Else $FileNames[$Index] = '' EndIf Next $RC = ArrayPack($FileNames) $RC = ShowMe($FileNames) ;for testing - just display to screen ;$RC = MakeCAB($CABFile,$FileNames) ;uncomment for production '@@Error = ' + @Error ? '@@SError = ' + @SError ? EndIf EndIf EndIf EndIf
;================== Start of UDFs ================== ...
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 1046 anonymous users online.
|
|
|