Windows Vista Forums

List of process with % of CPU use

  1. #1


    pascaljr Guest

    List of process with % of CPU use

    Hello,
    I'm trying to build a powershell script that returns all the process
    the are currently taking up more then 1% of CPU use. I got the script
    running, the everytime I execute it, it always returns the same
    process with the same percentual value for each. What am I doing
    wrong? Here's the script

    $procs_total = gwmi -Class Win32_PerfRawData_PerfProc_Process -Filter
    'name="_total"';
    $procs = gwmi -Class Win32_PerfRawData_PerfProc_Process -Filter
    'name<>"_total"';

    [int64]$totalpercentuser = 0;
    foreach ($proc in $procs_total)
    {$totalpercentuser = $totalpercentuser + $proc.PercentUserTime};



    [decimal] $perc = [System.Convert]::ToDecimal($totalpercentuser);

    foreach ($proc in $procs)
    {$proc_perct = (($proc.PercentUserTime / $perc) * 100);
    if ($proc_perct -gt 1){
    $proc_perct.ToString() + ' - Name: ' + $proc.Name;};
    } ;

    Thanks

      My System SpecsSystem Spec

  2. #2


    Ian_1 Guest

    RE: List of process with % of CPU use

    Wouldn't it just be simplier to use:

    get-process | where {$_.cpu -gt 1}

    ?

      My System SpecsSystem Spec

  3. #3


    Vadims Podans Guest

    Re: List of process with % of CPU use

    not simpler, because it not return CPU load in %

    "Ian_1" <fakeaddy@xxxxxx> wrote in message
    news:1FC65071-552F-46C3-8161-335A2AA2A537@xxxxxx

    > Wouldn't it just be simplier to use:
    >
    > get-process | where {$_.cpu -gt 1}
    >
    > ?

      My System SpecsSystem Spec

  4. #4


    pascaljr Guest

    Re: List of process with % of CPU use

    On Nov 5, 8:24*pm, "Vadims Podans" <vpodans> wrote:

    > not simpler, because it not return CPU load in %
    >
    > "Ian_1" <fakea...@xxxxxx> wrote in message
    >
    > news:1FC65071-552F-46C3-8161-335A2AA2A537@xxxxxx
    >

    > > Wouldn't it just be simplier to use:
    >

    > > get-process | where {$_.cpu -gt 1}
    >

    > > ?
    Exactly... I've made some progress... If I manage to make it work,
    I'll post the script...
    If anyone's done it, help will certainly be appreciated...
    Tks

      My System SpecsSystem Spec

List of process with % of CPU use

Similar Threads
Thread Thread Starter Forum Replies Last Post
WLM: How to stop the process of updating a list of all news? Saradukar Windows Live 0 28 Aug 2009
Process List on Another Machine news.motzarella.org PowerShell 5 29 Jun 2009
Failover Guest Cluster -- 'The process cannot access the file becauseit is being used by another process.' J Wolfgang Goerlich Virtual Server 0 06 Feb 2009
Getting list of modules loaded by a process forestial PowerShell 10 24 Mar 2008
Get Process List from window Service kalpesh Vista General 5 27 Jun 2007