Listing processes
In this recipe, we will list processes in the system.
How to do it...
Let's list processes using PowerShell.
Open PowerShell ISE. Go to Start | Accessories | Windows PowerShell | Windows PowerShell ISE
Add the following script and run it:
#list all processes to screen Get-Process #list 10 most recently started processes Get-Process | Sort -Property StartTime -Descending | Select Name, StartTime, Path, Responding -First 10 #save processes to a text file $txtFile = "C:\Temp\processes.txt" Get-Process | Out-File -FilePath $txtFile -Force notepad $txtFile #save processes to a csv file, #and display first five lines in file $csvFile = "C:\Temp\processes.csv" Get-Process | Export-Csv -Path $csvFile -Force -NoTypeInformation Get-Content $csvFile -totalCount 5 #save the top 5 CPU-heavy processes that #start with S to an xml file, #and display in Internet Explorer $xmlFile = "C:\Temp\processes.xml" #note we are using PowerShell V3 Where-Object syntax Get-Process | Where...