Solved

Kill all Lotus Notes Processes and delete temp files

Posted on 2006-07-18
7
24,494 Views
Last Modified: 2013-12-18
What I need help on is a script I have written to close Lotus Notes and delete all temp files.  i need my script to be able to kill all Notes processes and delete the temp files so I can relaunch it without having to re-logon.  Here is what I have so far.

'******************************************************************************
Call kill_process_matching("nlnotes.exe,nhldaemn.exe,nupdate.exe,nwrdaemn.exe,nnotesmm.exe,nlnotes.exe,notes.exe,nweb.exe,naldaemn.exe")
delete_file("C:\Program Files\Lotus\Notes\Data\~notes.lck")
delete_file("C:\Program Files\Lotus\Notes\Data\Cache.DSK")
delete_file("C:\Program Files\Lotus\Notes\Data\log.nsf")


'******************************************************************************
'kill_process_matching(str_procs)
'
'Description
'            This functions checks all running processes for specific processes that are passed to it
'            and terminates any that it findes
'inputs
'      str_procs a comma delimited list of process names to look for
'
'

'******************************************************************************

function kill_process_matching(str_procs)
      dim bool_imp_proc_running            'bool value used to identify if an identifed process is running
      dim arry_arg_proc_names                  'an array of strings used to store the split str_procs
      dim obj_service                   'used as a winmgmts object
      dim obj_current_proc                  'used as the current process being checked
      dim obj_current_proc_list            'array of objects to bee killed
      dim strComputer                        ' the name of the computer - can be a remote name
      dim str_proc_to_kill_name             'string used to store current important process to look for

                              

      if trim(str_procs) = "" then
            exit function
      End IF
      arry_arg_proc_names=split(str_procs, ",")
      If not InStr(1, str_procs, ",", 1) >0 Then str_procs=str_procs & ","
      strComputer = "."
      Set obj_service = GetObject("winmgmts:" _
          & "{impersonationLevel=impersonate}!\\" _
          & strComputer & "\root\cimv2")
      for each str_proc_to_kill_name in arry_arg_proc_names
      ' loop through the list of passed in process names to kill
            Set obj_current_proc_list = obj_service.ExecQuery _
                ("Select * from Win32_Process Where Name like '" & str_proc_to_kill_name & "'")
            on error resume next 'just incase it can't terminate it
            For Each obj_current_proc in obj_current_proc_list
            ' loop through each process that it found matching the current name

                obj_current_proc.Terminate()
            
            Next
            on error goto 0
            Set obj_current_proc_list = Nothing
      Next

End Function


Function delete_file(STR_FQ_FileName)  
  Dim fso, f1
  Set fso = CreateObject("Scripting.FileSystemObject")
  If fso.FileExists(STR_FQ_FileName)Then 'if the file alread exists get the file attributes and prep for writing
        On Error Resume Next
        Set f1 = fso.GetFile(STR_FQ_FileName)
        f1.Attributes=0
        f1.Delete
        Set f1 = Nothing
        On Error GoTo 0
  End If
 Set fso = Nothing
End Function

'******************************************************************************


For some reason I am either missing some temp files or some child process that is not letting me re-run Notes in the same windows sesssion.  i would like this script to be able to work for Notes versions 5 and 6.5.
0
Comment
Question by:tmassoglia01
  • 2
  • 2
7 Comments
 
LVL 9

Expert Comment

by:justchat_1
ID: 17134333
Try manually ending these processes via the task manager and then deleting the files-Do any processes or files say access denied or any other error??
0
 

Author Comment

by:tmassoglia01
ID: 17135887
No they do not, my problem is not the deleting of files or ending of processes, but rather which file need to be deleted and which processes need to be ended.
0
 
LVL 9

Expert Comment

by:justchat_1
ID: 17140993
Im not sure I understand the question...I thought the processes and files defined above were the ones you needed to end/delete
0
 
LVL 18

Accepted Solution

by:
marilyng earned 500 total points
ID: 17153229
Use KillNotes.exe and call that from a script.  Works on Both server and clients.   Will kill every process running in the Notes directory.   So then all you need to add in your batch file is one to stop the service first ( essential) then another to call the killNotes.exe

The only other way to do this is to step through the active PID's and compare that to a list of exe's that exist in the Notes Directory.  If found then kill that process.   I did this in NT in a batch file (awhile ago, so I would have to resurrect the code)

KillNotes:http://www-10.lotus.com/ldd/sandbox.nsf/0/7b70d2411b8dec9688256acb005c433f
0
 

Author Comment

by:tmassoglia01
ID: 17302403
Wow, thanks jsut what I needed!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Creating a bat file fo Note.ini 4 202
Missing Rules 1 294
Why won't this building block macro run? 6 285
Resolving notes group email address to old name with subdomain 10 148
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now