Forum Discussion

Patrick Burwell's avatar
Patrick Burwell
Copper Contributor
Jun 03, 2022

When do we get TOP in Windows Server Powershell?

So, like TOP in Linux, when do we get a more robust cmdline than tasklist that loops on a timer?

When I want to watch a remote upgrade of MicrosoftEdge I have to sit there and rerun...
tasklist /FI "IMAGENAME eq MicrosoftEdgeSetup.exe"
Over and over again. I mean COME ON. Wehn you have thousands, or even just hundreds, of servers and limited budget a simple TOP command sure would be NICE. 🙂 Perty-please Microsoft?

2 Replies

  • LainRobertson's avatar
    LainRobertson
    Silver Contributor

    Patrick Burwell 

     

    Hi, Patrick.

     

    You could wait for them to ship something but since PowerShell is more akin to a C#-like interpreter than a basic command shell (i.e. cmd.exe), there's probably not a lot of motivation for them to include something you can do yourself with minimal effort.

     

    Here's two unsophisticated examples to illustrate the point.

     

    A basic local check

    $MessageWritten = $null;
    while (Get-Process -Name "MicrosoftEdgeSetup" -ErrorAction:SilentlyContinue)
    {
        if (-not $MessageWritten) { Write-Host "$($env:COMPUTERNAME): Executing MicrosoftEdgeSetup..."; $MessageWritten = $true; } else { Wait-Event -Timeout 1; }
    }

    Extending that to check remotely (assuming WinRM has been configured either directly or via GPO)

    Invoke-Command -ComputerName host1.mydomain.com, host2.mydomain.com -ScriptBlock {
        $MessageWritten = $null;
        while (Get-Process -Name "MicrosoftEdgeSetup" -ErrorAction:SilentlyContinue)
        {
            if (-not $MessageWritten) { Write-Host "$($env:COMPUTERNAME): Executing MicrosoftEdgeSetup..."; $MessageWritten = $true; } else { Wait-Event -Timeout 1; }
        }
    }

    Cheers,

    Lain

    • Patrick Burwell's avatar
      Patrick Burwell
      Copper Contributor

      LainRobertson Well, see, thta is the point. Those script, though nice, don't have nearly the same easy capability as a "TOP" command does. As long as MS has been around, you'd think they would have had a "top" equiv by now.

Resources