1. Welcome Guest! In order to create a new topic or reply to an existing one, you must register first. It is easy and free. Click here to sign up now!.
    Dismiss Notice

How to determine which Task started a Process.

Discussion in 'Windows Home Server' started by ThomasAJ, Sep 8, 2009.

  1. ThomasAJ

    ThomasAJ Guest

    I have many tasks in Task Scheduler that kick off a particular program
    passing parameters to it so it knows what to do. Sometimes that program does
    not end gracefully and ends up consuming 50% CPU and slows system down. I do
    not find out about this until a user complains of slowness.

    The tasks run various VBS scripts which in turn runs an MS Access program.

    When the problem arises I look at Windows Task Manager and see that sure
    enough there is an MSACCESS.EXE at 50%. How the heck do I determine what Task
    initiated this process so I can see what parameter was passed to the MSACCESS
    program to see what code is being executed there?
    --
    Regards
    Tom
     
  2. "ThomasAJ" <ThomasAJ@discussions.microsoft.com> wrote in message
    news:9BE34128-B658-49DA-BA6D-52C489ACE325@microsoft.com...<!--coloro:blue--><span style="color:blue <!--/coloro-->
    >I have many tasks in Task Scheduler that kick off a particular program
    > passing parameters to it so it knows what to do. Sometimes that program
    > does
    > not end gracefully and ends up consuming 50% CPU and slows system down. I
    > do
    > not find out about this until a user complains of slowness.
    >
    > The tasks run various VBS scripts which in turn runs an MS Access program.
    >
    > When the problem arises I look at Windows Task Manager and see that sure
    > enough there is an MSACCESS.EXE at 50%. How the heck do I determine what
    > Task
    > initiated this process so I can see what parameter was passed to the
    > MSACCESS
    > program to see what code is being executed there?
    > --
    > Regards
    > Tom<!--colorc--><!--/colorc-->

    You can run ProcessExplorer
    () to identify the
    task that consumes excessive amounts of CPU time. Above it you will see what
    invoked it. When you right-click the rogue task then you can see its full
    command line.
     
  3. ThomasAJ

    ThomasAJ Guest

    Many thanks Pegasus

    Aside: coming from an IBM mid-range AS400 type backround in my former life I
    am *stunned* that this is not part of the OS from day 1. I see MS acquired
    the software in 2006.

    Perhaps there was a 'not as good' version.

    How did MS ever crack the corporate market.
    Answer: amazing marketing and price.

    (I am not an admin but a developer)
    --
    Regards
    Tom


    "Pegasus [MVP]" wrote:
    <!--coloro:blue--><span style="color:blue <!--/coloro-->
    >
    > "ThomasAJ" <ThomasAJ@discussions.microsoft.com> wrote in message
    > news:9BE34128-B658-49DA-BA6D-52C489ACE325@microsoft.com...<!--coloro:green--><span style="color:green <!--/coloro-->
    > >I have many tasks in Task Scheduler that kick off a particular program
    > > passing parameters to it so it knows what to do. Sometimes that program
    > > does
    > > not end gracefully and ends up consuming 50% CPU and slows system down. I
    > > do
    > > not find out about this until a user complains of slowness.
    > >
    > > The tasks run various VBS scripts which in turn runs an MS Access program.
    > >
    > > When the problem arises I look at Windows Task Manager and see that sure
    > > enough there is an MSACCESS.EXE at 50%. How the heck do I determine what
    > > Task
    > > initiated this process so I can see what parameter was passed to the
    > > MSACCESS
    > > program to see what code is being executed there?
    > > --
    > > Regards
    > > Tom<!--colorc--><!--/colorc-->
    >
    > You can run ProcessExplorer
    > () to identify the
    > task that consumes excessive amounts of CPU time. Above it you will see what
    > invoked it. When you right-click the rogue task then you can see its full
    > command line.
    >
    >
    > <!--colorc--><!--/colorc-->
     
  4. "ThomasAJ" <ThomasAJ@discussions.microsoft.com> wrote in message
    news:8E1422DD-04CF-487C-8090-2A61C7B5E30A@microsoft.com...<!--coloro:blue--><span style="color:blue <!--/coloro-->
    > Many thanks Pegasus
    >
    > Aside: coming from an IBM mid-range AS400 type backround in my former life
    > I
    > am *stunned* that this is not part of the OS from day 1. I see MS acquired
    > the software in 2006.
    >
    > Perhaps there was a 'not as good' version.
    >
    > How did MS ever crack the corporate market.
    > Answer: amazing marketing and price.
    >
    > (I am not an admin but a developer)
    > --
    > Regards
    > Tom<!--colorc--><!--/colorc-->

    You need to remember that MS DOS started its life in a garage, same as its
    competitors such as Commodore, Altair or TRS80. As you say, MS DOS become
    dominant over time with clever marketing and pricing. Some ten years ago
    Microsoft introduced its WMI (Windows Management Instrumentation) tool which
    allows you to monitor just about any aspect of Windows. Try the script
    below - it gives you similar information as the Process Explorer tool I
    previously mentioned. The core of the tool is just three lines of code.
    Powerful stuff!

    Note also that Microsoft does not hold a monopoly on bright ideas. Over the
    years the company has taken on board many developers such as Sysinternals
    who excelled with brilliant software.

    To test the code below, save it as c:\CommandLine.vbs, then double-click it.

    Set oArgs = WScript.Arguments
    If oArgs.Count = 0 Then
    sName = InputBox("Name of executable: ", "Exe Locator")
    if sName = "" then WScript.Quit
    Else
    sName = oArgs(0)
    End If

    If InStr(sName, "?") > 0 Then
    MsgBox "This tool will report the command line for an active executable." _
    & vbLf & vbLf & "Usage: CommandLine NameOfExecutable", 0, "Command Line
    Tool"
    WScript.Quit
    End If

    if lcase(right(sName, 4)) <> ".exe" then sName = sName & ".exe"

    Set oWMIService = GetObject("winmgmts:\\.\root\CIMV2")
    Set cItems = oWMIService.ExecQuery( _
    "SELECT * FROM Win32_Process where Name = '" & sName & "'")

    If cItems.Count = 0 Then
    MsgBox "Executable """ & sName & """ not found.", _
    0, "Command Line Tool"
    Else
    For Each oItem In cItems
    MsgBox "Handle: " & oItem.Handle & vbLf _
    & "Command Line: " & oItem.CommandLine & vbLf _
    & "Description: " & oItem.Description, _
    0, "Command Line Tool"
    Next
    End If
     

Share This Page