0 Replies Latest reply on Jan 14, 2004 1:30 PM by Support_1

    NI00399:Check for a Running Process

    Support_1 Specialist
      HOWTO: Check for a running process

      Document ID: NI00399

      Products: All NetInstall Editions

      Last Revised: 11/26/2003

      Summary:
      It is possible, and actually fairly simple, to check for a running process to determine whether file updates can be executed.


      Discussion:
      Running processes can be identified using NetInstall’s WMI capabilities.

      The following script shows how to find an instance of a running notepad.exe and wait for it to be terminated.


      : Check
      Set('WMI_ProcessId','')
      WMISimpleQuery('\\.\root\cimv2','Win32_Process','Caption=notepad.exe','wmi_')
      ProcessId
      ! Check whether the WMI Result is empty (no process found)
      If not %WMI_ProcessId%=''
      Sleep('5')
      ! Loop Till result is empty
      goto Check
      MsgBox
      Notepad is no longer running
      EndProc


      Note: You must add the 'Win32_Process' class when creating the WMI Simple Query command.