replicate Task Manager into powershell output

I am new in windows powershell. I want to replicate task manager Process GUI information into excel continuously for every 5 min. Can it be possible ?

2

1 Answer

You are probably looking for the Get-Process cmdlet and Task Scheduler.

try the following:

Get-Process | Select Handles,NPM,PM,WS,CPU,Id,SI,ProcessName,@{Name = 'Timestamp'; Expression = ({(Get-Date)})} | Export-Csv -Path C:\Junk\Processes.csv -Append

If you save this into a .ps1 file, you can then call it with a scheduled task and repeat the task every 5 minutes:enter image description here

Alternatively - you can use a PowerShell Loop and leave the script running in a window for as long as you need it to:

do { Get-Process | Select Handles,NPM,PM,WS,CPU,Id,SI,ProcessName,@{Name = 'Timestamp'; Expression = ({(Get-Date)})} | Export-Csv -Path C:\Junk\Processes.csv -Append start-sleep -Seconds 300
} while ($true -eq $true)

(in this case - 300 seconds is 5 minutes!)

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like