When do we get TOP in Windows Server Powershell?

Occasional Contributor

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?

1 Reply

@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