Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Trying my Hand at VBS Script To Backup Lotus Notes Files

$
0
0

I am just needing some suggestions. The following is the script:

set objFSO = CreateObject ("Scripting.FileSystemObject")
const OverwriteExhisting = True


'*************************************************************
'*                                                           *
'*             Check for Backup Destination                  *
'*       And Create Destination Folders if Necessary      *
'*                                                           *
'*************************************************************

if objFSO.FolderExists("I:\Backup") then
 if objFSO.FolderExists("I:\Backup\Notes") then
  wscript.echo "Backup Directory Found. Beginning Backup."
 else
  set objFolder = objFSO.createFolder ("I:\Backup\Notes")
  wscript.echo "Notes folder Created."
  
 end if
else
 set objFolder = objFSO.createFolder ("I:\Backup")
 set objFolder = objFSO.createFolder ("I:\Backup\Notes")
 wscript.echo "Backup\Notes Folders Created."
end if

'*************************************************************
'*             *
'*                 Backup Notes Datafiles       *
'*                                                           *
'*                 notes.ini                                 *
'*                 names.nsf                                 *
'*     desktop6.ndk                              *
'*                 *.id                                      *
'*************************************************************

if objFSO.FileExists("C:\Program Files (x86)\IBM\Lotus\notes\notes.ini") then
 objFSO.Copyfile "C:\Program Files (x86)\IBM\Lotus\notes\notes.ini", "I:\Backup\notes\", OverwriteExhisting
else
 wscript.echo "C:\Program Files\lotus\notes\notes.ini not on this machine, checking next location"
end if

if objFSO.FileExists("C:\Windows\SysWOW64\config\systemprofile\AppData\Local\Lotus\Notes\Data\notes.ini") then
 objFSO.Copyfile "C:\Windows\SysWOW64\config\systemprofile\AppData\Local\Lotus\Notes\Data\notes.ini", "I:\Backup\notes\",

OverwriteExhisting
else
 wscript.echo "C:\Windows\SysWOW64\config\systemprofile\AppData\Local\Lotus\Notes\Data\notes.ini not on this machine, checking next

location"
end if

if objFSO.FileExists("C:\Program Files (x86)\IBM\Lotus\notes\data\names.nsf") then
 objFSO.Copyfile "C:\Program Files (x86)\IBM\Lotus\notes\data\names.nsf", "I:\Backup\notes\", OverwriteExhisting
else
 wscript.echo "C:\Program Files\lotus\notes\names.nsf not on this machine, checking next location"
end if


if objFSO.FileExists("C:\Windows\SysWOW64\config\systemprofile\AppData\Local\Lotus\Notes\Data\names.nsf") then
 objFSO.Copyfile "C:\Windows\SysWOW64\config\systemprofile\AppData\Local\Lotus\Notes\Data\names.nsf", "I:\Backup\notes\",

OverwriteExhisting
else
 wscript.echo "C:\Windows\SysWOW64\config\systemprofile\AppData\Local\Lotus\Notes\Data\names.nsf not on this machine checking next

location"
end if


REM Copy Single User Install Desktop NDK

if objFSO.FileExists("C:\Program Files (x86)\IBM\Lotus\notes\data\Desktop8.ndk") then
    objFSO.Copyfile "C:\Program Files (x86)\IBM\Lotus\notes\data\Desktop8.ndk", "I:\Backup\notes\", OverwriteExhisting
else
end if

REM Copy Multi User Install Desktop NDK

objFSO.Copyfile "C:\Windows\SysWOW64\config\systemprofile\AppData\Local\Lotus\Notes\Data\Desktop8.ndk", "I:\Backup\notes\", OverwriteExhisting

REM Copy Single User Install userid file

if objFSO.FileExists("C:\Program Files (x86)\IBM\Lotus\notes\data\*.id") then
    objFSO.Copyfile "C:\Program Files (x86)\IBM\Lotus\notes\data\*.id", "I:\Backup\notes\", OverwriteExhisting
else
end if

REM Copy Multi User Install userid file

objFSO.Copyfile "C:\Windows\SysWOW64\config\systemprofile\AppData\Local\Lotus\Notes\Data\*.id", "I:\Backup\notes\", OverwriteExhisting

REM Copy Single User Install Bookmark NDK

if objFSO.FileExists("C:\Program Files (x86)\IBM\Lotus\notes\data\Bookmark.nsf") then
    objFSO.Copyfile "C:\Program Files (x86)\IBM\Lotus\notes\data\Bookmark.nsf", "I:\Backup\notes\", OverwriteExhisting
else
end if

REM Copy Multi User Install Bookmark NDK

objFSO.Copyfile "C:\Windows\SysWOW64\config\systemprofile\AppData\Local\Lotus\Notes\Data\Bookmark.nsf", "I:\Backup\notes\", OverwriteExhisting

wscript.echo "Backup Complete"

Okay I am wanting to back up the main Lotus Notes files to an Share on the network. Lotus Notes has been installed as a Single Login and Multi Login, so the Lotus Notes ID and Database files are in one of two, possibly three locations. Right now I am just dealing with the main two. The ID, is the only file I run into that can change and therefore I cannot get it to copy over. Well I can if I knew the exact location of the file on the machine. I have come to find out that FileExists cannot be used with wildcards. The Copyfile has not issues with wild cards. I guess  I am seeking some advice on how to get around the wild card issue as the .id file for Lotus notes is generally 6 or 7 characters long and any combination of letters and numbers.

I will say that this is my first script ever, and so yes I am sure it can be done more efficiently :) Your opinions will not bruise my feelings, but only make me a better person in learning something new. So thank you in advanced for your suggestions.

I am running the script with cscript so that it does not pop up the prompts, and going through Task Scheduler.


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>