######################### ### Desktop Manager Script - Pre or Post-session script to remove a DLL from the ExtMgr_Addins line ### VERSION 1.0 ### Made by Cooperteam Software - this script should be used as a Pre OR Post-session script in a Desktop Manager Profile ### Author John Coutel, john.coutel@cooperteam.com ### Date : 14/06/2017 ######################### ################################################ #### Declare the DLL to be removed in the dlltoremove$ variable below #### You can use the joker * to remove several strings if needed ################################################ dlltoremove$="DLPNotes*" LogLine(" ### Start of the Desktop Manager Script, v1.0 - Remove a DLL from ExtMgrAddins, example McAfee Plug-In ###") LogLine(" ### This script will remove the following string from the ExtMgrAddins line : dlltoremove$ ###") ################################################ #### 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 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 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 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 ####### 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 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 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 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 ####### 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 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$'") ####### 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 # Récupération de la ligne ExtMgr_Addins ExtMgr$ = GetFilePrefVar("notes_ini_path$","EXTMGR_ADDINS") # Affichage du la ligne dans le log LogLine(" Current content of ExtMgr_Addins line : ExtMgr$") If (ExtMgr$ = "") Then LogLine("The line ExtMgr_Addins line in not found in the notes.ini - End of the script") Goto CLEANUP_EXIT EndIF If (ExtMgr$ != "") Then new_line$ = RemoveElement("ExtMgr$",",","dlltoremove$") LogLine(" Build new ExtMgr_Addins line : new_line$") ## refresh the ExtMgr_Addins line in the notes.ini error$ = SearchReplaceFile("notes_ini_path$","ExtMgr$","new_line$") If (error$ != "") Then LogLine(" Error : Can't update ExtMgr_Addins line of the Notes.ini file, error : error$") Goto CLEANUP_EXIT Else LogLine(" Succeed updating ExtMgr_Addins line in the notes.ini") ExtMgr$ = GetFilePrefVar("notes_ini_path$","EXTMGR_ADDINS") LogLine(" New content of ExtMgr_Addins line : ExtMgr$") EndIF EndIf ############################## ## Remove Temporary files ## ############################## CLEANUP_EXIT: ############################## ## InstallScript End ## ############################## LogLine("_____________________________________________") LogLine(" ### End of the Desktop Manager Script ###")