Kaseya Community

Close Application Doesn't work

  • Hi,

    I'm creating a script to install a software but that requires outlook to be closed. I've used the 'close application' command in script but that doesn't seem to work. the script detects that outlook is running and tries to close it but fails on close outlook step. tried the sample script as shown below as well but same result. any help would be appreciated.

    Script Name: close outlook
    Script Description:

    IF Application is Running
    Parameter 1 : OUTLOOK.EXE
    THEN
    Close Application
    Parameter 1 : OUTLOOK.EXE
    OS Type : 0
    Send Message
    Parameter 1 : closed outlook
    Parameter 2 : 1
    OS Type : 0
    ELSE
    Send Message
    Parameter 1 : didn't close outlook
    Parameter 2 : 1
    OS Type : 0

    Legacy Forum Name: Close Application Doesn't work,
    Legacy Posted By Username: Mkris
  • We have used pskill for a similar situation using to kill Outlook. Or try the command below:

    execute shell command
    taskkill /f /im outlook.exe
    execute as system

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: JonJohnston
  • save this as a .vbs and it should help you along the way.
    We use kill files too.... The problem comes when outlook does not shutdown correctly.
    It can get testy, and it can also fry your PST files.

    I found this on google....
    ____________________________________________
    On Error Resume Next
    Set Outlook = GetObject(, “Outlook.Application”)
    If Err = 0 Then
    Outlook.Quit()
    End If
    _____________________________________________

    Here is also an exchange version...


    _____________________________________________
    Listing 1: CloseOutlook.vbs

    Option Explicit

    Dim objProcesses, objProcess

    Set objProcesses = GetObject("WinMgmts:root/CIMV2").ExecQuery( _
    "SELECT * FROM Win32_Process WHERE Name='OUTLOOK.EXE'")

    For Each objProcess In objProcesses
    objProcess.Terminate
    Next
    ______________________________________________


    the line I added this thing... ________________________ ....
    DOES NOT GO IN THE SCRIPT Smile

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: gamer-x
  • here is the site.

    http://thebackroomtech.com/2007/10/17/script-to-gracefully-close-an-outlook-pst-file-so-it-can-be-backed-up/

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: gamer-x
  • That is nice to have. Is a lot better then forcing a kill as I agree, it can cause .pst issues.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: JonJohnston