############################################################################################################################### ### InstallScript v1.7, (c) Cooperteam 2020 ### v1.0 : October 2010 - Installation of Desktop Manager 2.7 and up via our API Script ### v1.1 : April 2011 - Modification of the lines 96, 101 and 111 ### v1.2 : May 2011 - Creation of Install Option > "1" : Modify Notes Shortcuts | "2" : Hook deployment ### v1.3 : May 2012 - Search for additional Win7 64-bit Registry paths, and make a notes.ini clean-up for a previous Desktop Manager installation ### v1.4 : April 2014 - Add checking for Notes Release 9 ### v1.5 : December 2014 - StartupDBName line added for Notes Release 8.5.3 and up ### v1.6 : October 2019 - Validation for Desktop Manager 2.9 and Notes 10.0.x ### v1.7 : October 2020 - Validation for Notes 11.0.x ### ### Use this script if you wish to install our product using a third deployment tool, ie : Landesk, SCCM, PowerShell, etc ### Feel free to modify the script to match your environment ### please share your code, remark, comment in our Support Portal http://support.cooperteam.com | Contact : John Coutel / john.coutel@cooperteam.eu LogLine(" ### Installation of Cooperteam Desktop Manager - InstallScript v1.7 (October 2020) ###") ############################## ## Requirements ## ############################## ### Requirement 1 : DskMgrStart.nsf must be generated from Desktop Manager: Install files view > Use the 'Build DskMgrStart DB' button in the view. ### Requirement 2 : Select a temp path to deploy DskMgrStart.nsf, DskMgr.exe & InstallScript.txt to every user's workstation (if option 2 or 3, you also need nDskMgrHook.dll) ### Requirement 3 : Update the below variables desktop_manager_database$, desktop_manager_server$, install_folder_path$ and installoption$ ### Speficy the below path of the Desktop Manager database on the Server desktop_manager_database$ = "App\dskmgr.nsf" desktop_manager_server$ = "CN=ServerName/OU=EMEA/O=Company" ### Speficy the Get Install Folder path = Temporary folder install_folder_path$ = ExpandString("C:\temp\Cooperteam\") ### Speficy which method (option) is used to install Desktop Manager: ### For Notes 8.5.2 and prior, you can use either option "1" or "2". ### For Notes 8.5.3 and up, please use option "3" which is the Default value as most customers are now using Notes version 8.5.3 or higher ### Common install for all three options : It deploys the DskMgrStart.nsf into the Notes Data folder, and add dskmgrserver & dskmgrdatabase lines in the notes.ini ### Install Option 1 : copy the DskMgr.exe into the "Notes Data\DM" folder and modify Notes shortcuts ### Install Option 2 : copy the DskMgr.exe&nDskMgrHook.dll into the "Notes Data\DM" folder and declare the Hook in the notes.ini ### Install Option 3 : for Notes R8.5.3 and up, same as option 2 and also add the StartupDBName line installoption$ = "3" ### What's Next ? : decide how to deploy the package ("DskMgrStart.nsf, DskMgr.exe & InstallScript.txt" or if option 2 or 3, you also need nDskMgrHook.dll) ### How ? using your favorite deployment tool, ie : LanDesk, SMS, etc ### Then? run the below command line used to initiate the installation of Desktop Manager once you completed above requirements ### DskMgr.exe -SCRIPTNW ### Get the log file located in the path %temp%\DskMgr\DskMgrExeLogScript_.txt if you wish to get a report of the script execution. ### Requirements' End ############################## ## InstallScript Option ## ############################## If (installoption$ = "") Then LogLine(" ### Install Option line is empty in the script - End of the script ###") Goto END Else If (installoption$ = "1") Then LogLine(" ### Option 1: Deploy DskMgrStart.nsf in the Notes Data folder, Modify Notes Shortcuts, and then add the lines DskMgrServer & DskMgrDatabase in the notes.ini (for Notes 8.5.2 and below - old fashion) ###") EndIf If (installoption$ = "2") Then LogLine(" ### Option 2: Deploy DskMgrStart.nsf in the Notes Data folder, then add the lines DM Hook, DskMgrServer & DskMgrDatabase in the notes.ini (for Notes 8.5.2 and below) ###") EndIf If (installoption$ = "3") Then LogLine(" ### Option 3 (default installation): Deploy DskMgrStart.nsf in the Notes Data folder, then add the lines StartupDBName, DM Hook, $DskMgrServer & $DskMgrDatabase in the notes.ini file ###") EndIf EndIf ############################################################## ## Check if DskMgrStart.nsf is in the Install folder path ## ############################################################## is_there$ = IsFileExist("install_folder_path$DskMgrStart.nsf") If (is_there$ = "0") Then LogLine(" Error: Can't find DskMgrStart.nsf file in the install_folder_path$ folder, Desktop Manager install failed") Goto END EndIF ################################################################## ## Check if nDskMgrHook.dll is there for installoption$ 2 & 3 ## ################################################################## If (installoption$ >= "2") Then is_there$ = IsFileExist("install_folder_path$nDskMgrHook.dll") If (is_there$ = "0") Then LogLine(" Error: Can't find nDskMgrHook.dll file in the install_folder_path$ folder, Desktop Manager install failed") Goto END EndIF EndIF ################################################ #### Search for Notes Program folder path #### ################################################ GET_PROGRAM_PATH_BEGIN: LogLine("_____________________________________________") LogLine(" - Start to search for Notes Program path") ####### We try first using the Registry entries ####### ### Windows7/Win10 64-bit edition (x64) ### notes_program_path$ = GetRegistryKey("HKEY_LOCAL_MACHINE","SOFTWARE\Wow6432Node\Lotus\Notes","Path") If (notes_program_path$ != "") Then LogLine(" - Found Notes Program Path Key for Notes on Win7 or Win10 64-bit edition : notes_program_path$") ## Add \ at the end of the folder path last_char$ = Right("notes_program_path$","1") If (last_char$ != "\") Then notes_program_path$ = "notes_program_path$\" EndIF ## Check if Notes.exe is there is_there$ = IsFileExist("notes_program_path$Notes.exe") If (is_there$ = "1") Goto GET_PROGRAM_PATH_END EndIF ### Notes 11.0 ### LogLine("Open 'HKEY_LOCAL_MACHINE\SOFTWARE\Lotus\Notes\11.0'") notes_program_path$ = GetRegistryKey("HKEY_LOCAL_MACHINE","SOFTWARE\Lotus\Notes\11.0","Path") If (notes_program_path$ != "") Then LogLine(" - Found Notes Program Path Key for Notes 11.0 : notes_program_path$") ## Add \ at the end of the folder path last_char$ = Right("notes_program_path$","1") If (last_char$ != "\") Then notes_program_path$ = "notes_program_path$\" EndIF ## Check if Notes.exe is there is_there$ = IsFileExist("notes_program_path$Notes.exe") If (is_there$ = "1") Goto GET_PROGRAM_PATH_END EndIF ### Notes 10.0 ### LogLine("Open 'HKEY_LOCAL_MACHINE\SOFTWARE\Lotus\Notes\10.0'") notes_program_path$ = GetRegistryKey("HKEY_LOCAL_MACHINE","SOFTWARE\Lotus\Notes\10.0","Path") If (notes_program_path$ != "") Then LogLine(" - Found Notes Program Path Key for Notes 10.0 : notes_program_path$") ## Add \ at the end of the folder path last_char$ = Right("notes_program_path$","1") If (last_char$ != "\") Then notes_program_path$ = "notes_program_path$\" EndIF ## Check if Notes.exe is there is_there$ = IsFileExist("notes_program_path$Notes.exe") If (is_there$ = "1") Goto GET_PROGRAM_PATH_END EndIF ### Notes 9.0 ### LogLine("Open 'HKEY_LOCAL_MACHINE\SOFTWARE\Lotus\Notes\9.0'") notes_program_path$ = GetRegistryKey("HKEY_LOCAL_MACHINE","SOFTWARE\Lotus\Notes\9.0","Path") If (notes_program_path$ != "") Then LogLine(" - Found Notes Program Path Key for Notes 9.0 : notes_program_path$") ## Add \ at the end of the folder path last_char$ = Right("notes_program_path$","1") If (last_char$ != "\") Then notes_program_path$ = "notes_program_path$\" EndIF ## Check if Notes.exe is there is_there$ = IsFileExist("notes_program_path$Notes.exe") If (is_there$ = "1") Goto GET_PROGRAM_PATH_END EndIF ### Notes 8.0 ### LogLine("Open 'HKEY_LOCAL_MACHINE\SOFTWARE\Lotus\Notes\8.0'") notes_program_path$ = GetRegistryKey("HKEY_LOCAL_MACHINE","SOFTWARE\Lotus\Notes\8.0","Path") If (notes_program_path$ != "") Then LogLine(" - Found Notes Program Path Key for Notes 8.0 : notes_program_path$") ## Add \ at the end of the folder path last_char$ = Right("notes_program_path$","1") If (last_char$ != "\") Then notes_program_path$ = "notes_program_path$\" EndIF ## Check if Notes.exe is there is_there$ = IsFileExist("notes_program_path$Notes.exe") If (is_there$ = "1") Goto GET_PROGRAM_PATH_END EndIF ### Notes 7.0 ### LogLine("Open 'HKEY_LOCAL_MACHINE\SOFTWARE\Lotus\Notes\7.0'") notes_program_path$ = GetRegistryKey("HKEY_LOCAL_MACHINE","SOFTWARE\Lotus\Notes\7.0","Path") If (notes_program_path$ != "") Then LogLine(" - Found Notes Program Path Key for Notes 7.0 : notes_program_path$") ## Add \ at the end of the folder path last_char$ = Right("notes_program_path$","1") If (last_char$ != "\") Then notes_program_path$ = "notes_program_path$\" EndIF ## Check if Notes.exe is there is_there$ = IsFileExist("notes_program_path$Notes.exe") If (is_there$ = "1") Goto GET_PROGRAM_PATH_END EndIF ### Notes 6.0 ### LogLine("Open 'HKEY_LOCAL_MACHINE\SOFTWARE\Lotus\Notes\6.0'") notes_program_path$ = GetRegistryKey("HKEY_LOCAL_MACHINE","SOFTWARE\Lotus\Notes\6.0","Path") If (notes_program_path$ != "") Then LogLine(" - Found Notes Program Path Key for Notes 6.0 : notes_program_path$") ## Add \ at the end of the folder path last_char$ = Right("notes_program_path$","1") If (last_char$ != "\") Then notes_program_path$ = "notes_program_path$\" EndIF ## Check if Notes.exe is there is_there$ = IsFileExist("notes_program_path$Notes.exe") If (is_there$ = "1") Goto GET_PROGRAM_PATH_END EndIF ####### We try now pre-registered path ####### LogLine(" - No Notes Program Path Key found in the registry, try now pre-registered path") ### C:\Notes\ notes_program_path$ = "C:\Notes\" is_there$ = IsFileExist("notes_program_path$Notes.exe") If (is_there$ = "1") Goto GET_PROGRAM_PATH_END ### C:\Lotus\Notes\ notes_program_path$ = "C:\Lotus\Notes\" is_there$ = IsFileExist("notes_program_path$Notes.exe") If (is_there$ = "1") Goto GET_PROGRAM_PATH_END ### C:\Program Files\Lotus\Notes\ notes_program_path$ = "C:\Program Files\Lotus\Notes\" is_there$ = IsFileExist("notes_program_path$Notes.exe") If (is_there$ = "1") Goto GET_PROGRAM_PATH_END ### C:\Program Files\IBM\Lotus\Notes\ notes_program_path$ = "C:\Program Files\IBM\Lotus\Notes\" is_there$ = IsFileExist("notes_program_path$Notes.exe") If (is_there$ = "1") Goto GET_PROGRAM_PATH_END ### C:\Program Files (x86)\IBM\Lotus\Notes\ notes_program_path$ = "C:\Program Files (x86)\IBM\Lotus\Notes\" is_there$ = IsFileExist("notes_program_path$Notes.exe") If (is_there$ = "1") Goto GET_PROGRAM_PATH_END ### C:\Program Files (x86)\Lotus\Notes\ notes_program_path$ = "C:\Program Files (x86)\Lotus\Notes\" is_there$ = IsFileExist("notes_program_path$Notes.exe") If (is_there$ = "1") Goto GET_PROGRAM_PATH_END ### C:\Program Files (x86)\Notes\ notes_program_path$ = "C:\Program Files (x86)\Notes\" is_there$ = IsFileExist("notes_program_path$Notes.exe") If (is_there$ = "1") Goto GET_PROGRAM_PATH_END ####### We have to cancel the installation, can't find Notes Program path ####### LogLine(" Error: Impossible to find Notes Program path on disk") Goto CLEANUP_EXIT ####### We have found the Notes Program path ####### GET_PROGRAM_PATH_END: LogLine(" => Notes Program Path is : 'notes_program_path$'") ############################################# #### Search for Notes Data folder path #### ############################################# GET_DATA_PATH_BEGIN: LogLine("_____________________________________________") LogLine(" - Start to search for Notes Data Path") ####### We try first using the Registry entries ####### ### Windows7/Win10 64-bit edition (x64) ### notes_data_path$ = GetRegistryKey("HKEY_LOCAL_MACHINE","SOFTWARE\Wow6432Node\Lotus\Notes\","DataPath") If (notes_data_path$ != "") Then LogLine(" - Found Notes Data Path Key for Notes on Win7/Win10 64-bit edition : notes_data_path$") ## Add \ at the end of the folder path last_char$ = Right("notes_data_path$","1") If (last_char$ != "\") Then notes_data_path$ = "notes_data_path$\" EndIF ## Check if Names.nsf is there is_there$ = IsFileExist("notes_data_path$Names.nsf") If (is_there$ = "1") Goto GET_DATA_PATH_END EndIF ### Notes 11.0 ### LogLine("Open 'HKEY_LOCAL_MACHINE\SOFTWARE\Lotus\Notes\11.0'") notes_data_path$ = GetRegistryKey("HKEY_LOCAL_MACHINE","SOFTWARE\Lotus\Notes\11.0","DataPath") If (notes_data_path$ != "") Then LogLine(" - Found Notes Data Path Key for Notes 11.0 : notes_data_path$") ## Add \ at the end of the folder path last_char$ = Right("notes_data_path$","1") If (last_char$ != "\") Then notes_data_path$ = "notes_data_path$\" EndIF ## Check if Names.nsf is there is_there$ = IsFileExist("notes_data_path$Names.nsf") If (is_there$ = "1") Goto GET_DATA_PATH_END EndIF ### Notes 10.0 ### LogLine("Open 'HKEY_LOCAL_MACHINE\SOFTWARE\Lotus\Notes\10.0'") notes_data_path$ = GetRegistryKey("HKEY_LOCAL_MACHINE","SOFTWARE\Lotus\Notes\10.0","DataPath") If (notes_data_path$ != "") Then LogLine(" - Found Notes Data Path Key for Notes 10.0 : notes_data_path$") ## Add \ at the end of the folder path last_char$ = Right("notes_data_path$","1") If (last_char$ != "\") Then notes_data_path$ = "notes_data_path$\" EndIF ## Check if Names.nsf is there is_there$ = IsFileExist("notes_data_path$Names.nsf") If (is_there$ = "1") Goto GET_DATA_PATH_END EndIF ### Notes 9.0 ### LogLine("Open 'HKEY_LOCAL_MACHINE\SOFTWARE\Lotus\Notes\9.0'") notes_data_path$ = GetRegistryKey("HKEY_LOCAL_MACHINE","SOFTWARE\Lotus\Notes\9.0","DataPath") If (notes_data_path$ != "") Then LogLine(" - Found Notes Data Path Key for Notes 9.0 : notes_data_path$") ## Add \ at the end of the folder path last_char$ = Right("notes_data_path$","1") If (last_char$ != "\") Then notes_data_path$ = "notes_data_path$\" EndIF ## Check if Names.nsf is there is_there$ = IsFileExist("notes_data_path$Names.nsf") If (is_there$ = "1") Goto GET_DATA_PATH_END EndIF ### Notes 8.0 ### LogLine("Open 'HKEY_LOCAL_MACHINE\SOFTWARE\Lotus\Notes\8.0'") notes_data_path$ = GetRegistryKey("HKEY_LOCAL_MACHINE","SOFTWARE\Lotus\Notes\8.0","DataPath") If (notes_data_path$ != "") Then LogLine(" - Found Notes Data Path Key for Notes 8.0 : notes_data_path$") ## Add \ at the end of the folder path last_char$ = Right("notes_data_path$","1") If (last_char$ != "\") Then notes_data_path$ = "notes_data_path$\" EndIF ## Check if Names.nsf is there is_there$ = IsFileExist("notes_data_path$Names.nsf") If (is_there$ = "1") Goto GET_DATA_PATH_END EndIF ### Notes 7.0 ### LogLine("Open 'HKEY_LOCAL_MACHINE\SOFTWARE\Lotus\Notes\7.0'") notes_data_path$ = GetRegistryKey("HKEY_LOCAL_MACHINE","SOFTWARE\Lotus\Notes\7.0","DataPath") If (notes_data_path$ != "") Then LogLine(" - Found Notes Data Path Key for Notes 7.0 : notes_data_path$") ## Add \ at the end of the folder path last_char$ = Right("notes_data_path$","1") If (last_char$ != "\") Then notes_data_path$ = "notes_data_path$\" EndIF ## Check if Names.nsf is there is_there$ = IsFileExist("notes_data_path$Names.nsf") If (is_there$ = "1") Goto GET_DATA_PATH_END EndIF ### Notes 6.0 ### LogLine("Open 'HKEY_LOCAL_MACHINE\SOFTWARE\Lotus\Notes\6.0'") notes_data_path$ = GetRegistryKey("HKEY_LOCAL_MACHINE","SOFTWARE\Lotus\Notes\6.0","DataPath") If (notes_data_path$ != "") Then LogLine(" - Found Notes Data Path Key for Notes 6.0 : notes_data_path$") ## Add \ at the end of the folder path last_char$ = Right("notes_data_path$","1") If (last_char$ != "\") Then notes_data_path$ = "notes_data_path$\" EndIF ## Check if Names.nsf is there is_there$ = IsFileExist("notes_data_path$Names.nsf") If (is_there$ = "1") Goto GET_DATA_PATH_END EndIF ####### We try now pre-registered path ####### LogLine(" - No Notes Data Path Key found in the registry, try now pre-registered path") ### %Local AppData%\Lotus\Notes\Data\ LogLine("Open 'HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders'") notes_data_path$ = GetRegistryKey("HKEY_CURRENT_USER","SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","Local AppData") If (notes_data_path$ != "") Then LogLine(" => Local AppData Key is : 'notes_data_path$'") ## Add \ at the end of the folder path last_char$ = Right("notes_data_path$","1") If (last_char$ != "\") Then notes_data_path$ = "notes_data_path$\" EndIF ## Add Lotus\Notes\Data\ notes_data_path$ = "notes_data_path$Lotus\Notes\Data\" ## Check if Names.nsf is there is_there$ = IsFileExist("notes_data_path$Names.nsf") If (is_there$ = "1") Goto GET_DATA_PATH_END EndIF ### %AppData%\Lotus\Notes\Data\ notes_data_path$ = GetRegistryKey("HKEY_CURRENT_USER","SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","AppData") If (notes_data_path$ != "") Then LogLine(" => AppData Key is : 'notes_data_path$'") ## Add \ at the end of the folder path last_char$ = Right("notes_data_path$","1") If (last_char$ != "\") Then notes_data_path$ = "notes_data_path$\" EndIF ## Add Lotus\Notes\Data\ notes_data_path$ = "notes_data_path$Lotus\Notes\Data\" ## Check if Names.nsf is there is_there$ = IsFileExist("notes_data_path$Names.nsf") If (is_there$ = "1") Goto GET_DATA_PATH_END EndIF ### \Data\ notes_data_path$ = "notes_program_path$Data\" is_there$ = IsFileExist("notes_data_path$Names.nsf") If (is_there$ = "1") Goto GET_DATA_PATH_END ### C:\Users\Public\Lotus\Notes\Data\ notes_data_path$ = "C:\Users\Public\Lotus\Notes\Data\" is_there$ = IsFileExist("notes_data_path$Names.nsf") If (is_there$ = "1") Goto GET_DATA_PATH_END ### C:\Users\Public\Notes\Data\ notes_data_path$ = "C:\Users\Public\Notes\Data\" is_there$ = IsFileExist("notes_data_path$Names.nsf") If (is_there$ = "1") Goto GET_DATA_PATH_END ####### We can try to get the Notes Data folder from the Notes.ini file (directory line) ####### LogLine(" => Error: Impossible to find Notes Data path on disk, so we will try to locate the Notes.ini") notes_data_path$ = "" Goto GET_INI_PATH_BEGIN ####### We have found the Notes Data path ####### GET_DATA_PATH_END: LogLine(" => Notes Data Path is : 'notes_data_path$'") ##################################### #### Search for Notes.ini Path #### ##################################### GET_INI_PATH_BEGIN: LogLine("_____________________________________________") LogLine(" - Start to search for Notes.ini Path") ### Notes.ini notes_ini_path$ = "notes_program_path$Notes.ini" is_there$ = IsFileExist("notes_ini_path$") If (is_there$ = "1") Goto GET_INI_PATH_END ### Notes.ini If (notes_data_path$ != "") Then notes_ini_path$ = "notes_data_path$Notes.ini" is_there$ = IsFileExist("notes_ini_path$") If (is_there$ = "1") Goto GET_INI_PATH_END EndIF ####### We use the Registry entries for Multi-User ####### ### Windows 7 64-bit edition (x64) ### LogLine("Open 'HKEY_CURRENT_USER\SOFTWARE\Wow6432Node\Lotus\Notes'") notes_ini_path$ = GetRegistryKey("HKEY_CURRENT_USER","SOFTWARE\Wow6432Node\Lotus\Notes","NotesIniPath") If (notes_ini_path$ != "") Then LogLine(" - Found Notes.ini Path Key for Notes on Windows 7 64-bit edition : notes_ini_path$") ## Check if Notes.ini is there is_there$ = IsFileExist("notes_ini_path$") If (is_there$ = "1") Goto GET_INI_PATH_END EndIF ### Notes 10.0 ### LogLine("Open 'HKEY_CURRENT_USER\SOFTWARE\Lotus\Notes\10.0'") notes_ini_path$ = GetRegistryKey("HKEY_CURRENT_USER","SOFTWARE\Lotus\Notes\10.0","NotesIniPath") If (notes_ini_path$ != "") Then LogLine(" - Found Notes.ini Path Key for Notes 10.0 : notes_ini_path$") ## Check if Notes.ini is there is_there$ = IsFileExist("notes_ini_path$") If (is_there$ = "1") Goto GET_INI_PATH_END EndIF ### Notes 9.0 ### LogLine("Open 'HKEY_CURRENT_USER\SOFTWARE\Lotus\Notes\9.0'") notes_ini_path$ = GetRegistryKey("HKEY_CURRENT_USER","SOFTWARE\Lotus\Notes\9.0","NotesIniPath") If (notes_ini_path$ != "") Then LogLine(" - Found Notes.ini Path Key for Notes 9.0 : notes_ini_path$") ## Check if Notes.ini is there is_there$ = IsFileExist("notes_ini_path$") If (is_there$ = "1") Goto GET_INI_PATH_END EndIF ### Notes 8.0 ### LogLine("Open 'HKEY_CURRENT_USER\SOFTWARE\Lotus\Notes\8.0'") notes_ini_path$ = GetRegistryKey("HKEY_CURRENT_USER","SOFTWARE\Lotus\Notes\8.0","NotesIniPath") If (notes_ini_path$ != "") Then LogLine(" - Found Notes.ini Path Key for Notes 8.0 : notes_ini_path$") ## Check if Notes.ini is there is_there$ = IsFileExist("notes_ini_path$") If (is_there$ = "1") Goto GET_INI_PATH_END EndIF ### Notes 7.0 ### LogLine("Open 'HKEY_CURRENT_USER\SOFTWARE\Lotus\Notes\7.0'") notes_ini_path$ = GetRegistryKey("HKEY_CURRENT_USER","SOFTWARE\Lotus\Notes\7.0","NotesIniPath") If (notes_ini_path$ != "") Then LogLine(" - Found Notes.ini Path Key for Notes 7.0 : notes_ini_path$") ## Check if Notes.ini is there is_there$ = IsFileExist("notes_ini_path$") If (is_there$ = "1") Goto GET_INI_PATH_END EndIF ### Notes 6.0 ### LogLine("Open 'HKEY_CURRENT_USER\SOFTWARE\Lotus\Notes\6.0'") notes_ini_path$ = GetRegistryKey("HKEY_CURRENT_USER","SOFTWARE\Lotus\Notes\6.0","NotesIniPath") If (notes_ini_path$ != "") Then LogLine(" - Found Notes.ini Path Key for Notes 6.0 : notes_ini_path$") ## Check if Notes.ini is there is_there$ = IsFileExist("notes_ini_path$") If (is_there$ = "1") Goto GET_INI_PATH_END EndIF ####### We have to cancel the installation, can't find Notes.ini path ####### LogLine(" => Error: Impossible to find Notes.ini file on disk") Goto CLEANUP_EXIT ####### We have found the Notes.ini path ####### GET_INI_PATH_END: LogLine(" => Notes.ini Path is : 'notes_ini_path$'") ####### Display Notes Release ####### check_notes_release$ = GetFilePrefVar("notes_ini_path$","FaultRecovery_Build") LogLine(" Notes Release detected in the notes.ini, line FaultRecovery_Build: check_notes_release$") ####### If we have not found yet the Notes Data folder, we use the one from the Notes.ini ####### If (notes_data_path$ = "") Then ## Get DIRECTORY line from Notes.ini notes_data_path$ = GetFilePrefVar("notes_ini_path$","DIRECTORY") If (notes_data_path$ != "") Then ## Add \ at the end of the folder path last_char$ = Right("notes_data_path$","1") If (last_char$ != "\") Then notes_data_path$ = "notes_data_path$\" EndIF ## Check if Names.nsf is there is_there$ = IsFileExist("notes_data_path$Names.nsf") If (is_there$ = "0") Then notes_data_path$ = "" EndIF EndIF ## If we can't locate the Notes Data Path, we have to cancel the installation If (notes_data_path$ = "") Then LogLine(" => Error: Impossible to find Notes Data path on disk") Goto CLEANUP_EXIT Else LogLine(" => Notes Data Path is : 'notes_data_path$'") EndIf EndIf #################################################### ## Remove previous Desktop Manager installation ## #################################################### LogLine("_____________________________________________") LogLine(" - Remove any previous DM installation") ### Search for any DM folder in the Notes Data folder is_there$ = IsFolderExist("notes_data_path$DM\") If (is_there$ = "1") Then LogLine(" Remove existing DM folder and its content") error$ = DeleteFolder("notes_data_path$DM\","Yes") EndIF ### Search for any DskMgr binary in the Notes Program folder (and subfolders) dm_program_list$ = SearchMultiFile("notes_program_path$","*dskmgr*.exe,*dskmgr*.dll","","1") If (dm_program_list$ != "") Then file_number$ = GetElementNumber("dm_program_list$","|") LogLine(" Found file_number$ DM file located in dm_program_list$") For counter$ = 1 To file_number$ file_path$ = GetNthElement("dm_program_list$","|","counter$") DeleteFile("file_path$") LogLine(" Found & deleted the following binary: file_path$") Next EndIF ### Search for DskMgr.exe in the Windows Startup folder folder_path$ = GetRegistryKey("HKEY_CURRENT_USER","Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","Startup") is_there$ = IsFileExist("folder_path$\DskMgr.exe") If (is_there$ = "1") Then LogLine(" Remove existing DskMgr.exe file : folder_path$\DskMgr.exe") error$ = DeleteFile("folder_path$\DskMgr.exe") EndIF folder_path$ = GetRegistryKey("HKEY_LOCAL_MACHINE","Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","Common Startup") is_there$ = IsFileExist("folder_path$\DskMgr.exe") If (is_there$ = "1") Then LogLine(" Remove existing DskMgr.exe file : folder_path$\DskMgr.exe") error$ = DeleteFile("folder_path$\DskMgr.exe") EndIF ### Search for any existing DskMgrStart.nsf in the Notes Data Folder is_there$ = IsFileExist("notes_data_path$DskMgrStart.nsf") If (is_there$ = "1") Then LogLine(" Delete the existing DskMgrStart.nsf database found in the Notes data folder") error$ = DeleteFile("notes_data_path$DskMgrStart.nsf") EndIf ### Run DskMgr.exe to clean-up the notes.ini to remove any old Desktop Manager lines quote$ = """ command_line$ = "-INI quote$notes_ini_path$quote$" error$ = RunSequenceProgram("install_folder_path$DskMgr.exe","command_line$") LogLine(" Run the DskMgr.exe with the -INI option to remove any old Desktop Manager lines of the Notes.ini") #################################################### ## Copy the DskMgrStart database to Data folder ## #################################################### LogLine("_____________________________________________") LogLine(" Starting a copy of the DskMgrStart database in the Notes Data folder") ## Is File already there ? is_there$ = IsFileExist("notes_data_path$DskMgrStart.nsf") If (is_there$ = "1") Then LogLine(" => Done : The DskMgrStart.nsf database was already installed into Notes data folder") Else ## Copy the file error$ = CopyFile("install_folder_path$DskMgrStart.nsf","notes_data_path$DskMgrStart.nsf") If (error$ != "") Then LogLine(" Error: Can't copy DskMgrStart.nsf file to Notes data folder : error$") Goto CLEANUP_EXIT EndIF is_there$ = IsFileExist("notes_data_path$DskMgrStart.nsf") If (is_there$ = "0") Then LogLine(" Error: Can't copy DskMgrStart.nsf file to Notes data folder") Goto CLEANUP_EXIT EndIF EndIF ############################################################################## ## installoption 1 : Add Lines to Notes.ini file and modify Notes Shortcut ## ############################################################################## If (installoption$ = "1") Then LogLine("_____________________________________________") LogLine(" Install Option 1 in progress : Adding Notes.ini lines and modify Notes Shortcut") error$ = SetFilePrefVar("notes_ini_path$","$DskMgrDatabase","desktop_manager_database$") error$ = SetFilePrefVar("notes_ini_path$","$DskMgrServer","desktop_manager_server$") If (error$ != "") Then LogLine(" Error: Can't update Notes.ini file") Goto CLEANUP_EXIT Else LogLine(" Notes.ini updated correctly") EndIF ## Run DskMgr.exe to update Notes Shortcuts quote$ = """ command_line$ = "-S quote$notes_program_path$Notes.exequote$ DskMgrStart.nsf" error$ = RunSequenceProgram("install_folder_path$DskMgr.exe","command_line$") ## Check if the DskMgrShortcut.txt contains notes.exe shortcut modified DskMgrShortcut$ = ExpandString("%temp%\DskMgr\DskMgrShortcut.txt") error$ = SearchReplaceFile("DskMgrShortcut$","DskMgrStart.nsf","DskMgrStart.nsf") If (error$ != "") Then LogLine(" Error: Lotus Notes Shortcut(s) not updated - Check Log file %temp%\DskMgr\ ") Goto CLEANUP_EXIT Else LogLine(" Lotus Notes shortcut(s) updated correctly") EndIF EndIF ############################################################################### ## installoption 2 or 3 : Copy Hook and Exe and Add Lines to Notes.ini file ## ############################################################################### If (installoption$ >= "2") Then LogLine("_____________________________________________") LogLine(" Install Option 2 or 3 in progress : Copying Hook & Exe and Addings Lines in the Notes.ini file") ## Copy DM Hook into Notes Data\DM\ folder error$ = CopyFile("install_folder_path$nDskMgrHook.dll","notes_data_path$\DM\nDskMgrHook.dll") If (error$ != "") Then LogLine(" Error: Can't copy nDskMgrHook.dll file to notes_data_path$\DM\ : error$") Goto CLEANUP_EXIT Else LogLine(" Succeed Copy of the nDskMgrHook.dll") EndIF ## Copy DM Exe into Notes Data\DM\ folder error$ = CopyFile("install_folder_path$DskMgr.exe","notes_data_path$\DM\DskMgr.exe") If (error$ != "") Then LogLine(" Error: Can't copy DskMgr.exe file to notes_data_path$\DM\ : error$") Goto CLEANUP_EXIT Else LogLine(" Succeed Copy of the DskMgr.exe") EndIF ### Add or Modify the line EXTMGR_ADDINS ### ## Get the Dos 8.3 Short path to the Hook get_short_path$ = GetShortPath("notes_data_path$\DM\nDskMgrHook.dll") LogLine(" Dos 8.3 Short path : get_short_path$") ## Search String NDSKMG and remove the N character short_path$ = ReplaceSubString("get_short_path$","NDSKMG","DSKMG") LogLine(" Dos 8.3 Short path (modified) : short_path$") ## Check if the ExtMgr_Addins line exists in the notes.ini is_extmgr_there$ = GetFilePrefVar("notes_ini_path$","EXTMGR_ADDINS") LogLine(" Current content of ExtMgr_Addins line : is_extmgr_there$") If (is_extmgr_there$ = "") Then error$ = SetFilePrefVar("notes_ini_path$","EXTMGR_ADDINS","short_path$") LogLine(" Succeed adding new ExtMgr_Addins line in the notes.ini") EndIF If (is_extmgr_there$ != "") Then count_element$ = GetElementNumber("is_extmgr_there$",",") LogLine(" Found count_element$ element(s) in the current ExtMgr_Addins line") If (count_element$ = "1") Then new_extmgr$ = "short_path$,is_extmgr_there$" ## refresh the ExtMgr_Addins line of the notes.ini error$ = SearchReplaceFile("notes_ini_path$","is_extmgr_there$","new_extmgr$") If (error$ != "") Then LogLine(" Error: Can't update ExtMgr_Addins line of the Notes.ini file") Goto CLEANUP_EXIT EndIF Else ## Search for Hook string in the current extmgr_addins line offset$ = InStr("is_extmgr_there$","DSKMG~1.DLL") ## Modify existing extmgr_addins line If (offset$ = "0") Then ## insert the shortpath of the Hook in the content of ExtMgr_addins new_extmgr$ = InsertElement("is_extmgr_there$",",","short_path$","1") ## refresh the ExtMgr_Addins line of the notes.ini error$ = SearchReplaceFile("notes_ini_path$","is_extmgr_there$","new_extmgr$") If (error$ != "") Then LogLine(" Error: Can't update ExtMgr_Addins line of the Notes.ini file") Goto CLEANUP_EXIT Else LogLine(" Succeed updating ExtMgr_Addins line in the notes.ini") EndIf EndIf If (offset$ != "0") Then LogLine(" ExtMgr_Addins line contains already DM Hook path") EndIF EndIF EndIf ### Modify the two others Notes.ini lines for $DskMgrDatabase & $DskMgrServer ### error$ = SetFilePrefVar("notes_ini_path$","$DskMgrDatabase","desktop_manager_database$") Get_DskMgrDatabase_value$ = GetFilePrefVar("notes_ini_path$","$DskMgrDatabase") LogLine(" Notes.ini updated, line $DskMgrDatabase = Get_DskMgrDatabase_value$") error$ = SetFilePrefVar("notes_ini_path$","$DskMgrServer","desktop_manager_server$") Get_DskMgrServer_value$ = GetFilePrefVar("notes_ini_path$","$DskMgrServer") LogLine(" Notes.ini updated, line $DskMgrServer = Get_DskMgrServer_value$") If (error$ != "") Then LogLine(" Error: Can't update Notes.ini file for $DskMgrDatabase & $DskMgrServer") Goto CLEANUP_EXIT Else LogLine(" Notes.ini updated correctly, lines $DskMgrDatabase=desktop_manager_database$ & $DskMgrServer=desktop_manager_server$ added") EndIF ## Clean-up Hook error$ = DeleteFile("install_folder_path$nDskMgrHook.dll") EndIF ############################################################################################# ## installoption 3 : Add StartupDBName in the Notes.ini file for Notes client 8.5.3 or up ## ############################################################################################# If (installoption$ = "3") Then GoTo InstallStartupDBName EndIF ## Check Notes Release check_notes_release$ = GetFilePrefVar("notes_ini_path$","FaultRecovery_Build") result_string_full$ = RightStringBack("check_notes_release$","Release ") result_string_short$ = Left("result_string_full$","1") If (result_string_short$ = "9") Then GoTo InstallStartupDBName EndIF If (result_string_short$ = "1") Then GoTo InstallStartupDBName EndIF If (result_string_full$ = "8.5.3") Then GoTo InstallStartupDBName EndIF ## Add StartupDBname if installtopion = "3" OR if the Notes Release is 8.5.3 or higher InstallStartupDBName: LogLine("_____________________________________________") LogLine(" Install Option 3 in progress : StartupDBName line will be added in the Notes.ini because the current Notes Release is higher than 8.5.3") error$ = SetFilePrefVar("notes_ini_path$","StartupDBName","DskMgrStart.nsf") Get_StartupDBName_value$ = GetFilePrefVar("notes_ini_path$","StartupDBName") LogLine(" Notes.ini updated, line StartupDBName = Get_StartupDBName_value$") If (error$ != "") Then LogLine(" Error: Can't update Notes.ini file for the line StartupDBname") Goto CLEANUP_EXIT Else LogLine(" The Notes.ini has been correctly updated") EndIF ############################## ## Remove Temporary files ## ############################## CLEANUP_EXIT: error$ = DeleteFile("install_folder_path$DskMgrStart.nsf") LogLine(" DskmgrStart.nsf deleted from the Install Folder path") ############################## ## InstallScript End ## ############################## END: LogLine(" ### End of the Desktop Manager Installation ###")