- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to display a few numbers of results in Get-Process in PowerShell?
To display only the first 5 processes you need to use –First parameter in the Select-Object pipeline statement. You can use multiple filter statements and later at last pipeline the –First command to display only a few results.
Command
Get-Process | Select -First 5
Output
Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName ------- ------ ----- ----- ------ -- -- ----------- 498 26 9736 18624 2.27 6320 1 AcroRd32 624 51 112048 17036 44.84 8052 1 AcroRd32 572 32 22424 28740 5.63 6340 1 ApplicationFrameHost 156 9 1416 4984 0.08 4412 0 armsvc 208 13 10096 17012 10.17 23412 0 audiodg
Similarly, you can use the same command for WMI and CIM.
Get-WmiObject Win32_Process | Select -First 5 Get-CimInstance Win32_Process | Select -First 5
Command
To display the last certain number of results, you need to use –Last parameter in the Select-Object pipeline parameter.
Get-Process | Select -Last 5
Output
Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName ------- ------ ----- ----- ------ -- -- ----------- 150 9 2904 7164 5.17 11356 0 WmiPrvSE 265 11 5968 10040 0.97 17448 0 WmiPrvSE 190 13 4648 9128 0.33 21412 0 WmiPrvSE 163 12 2032 6516 0.30 12224 1 WZQKPICK 340 20 5188 15152 39.91 4420 0 ZeroConfigService
Similarly, you can apply –Last for WMI and CIM commands.
Get-WmiObject Win32_Process | Select -Last 5 Get-CimInstance Win32_Process | Select -Last 5
- Related Articles
- How to get process output in GridView format in PowerShell ?
- How to get all the Get-Process properties using PowerShell?
- How to display specific properties from Get-Service output in PowerShell?
- How to get the Process performance counter using PowerShell?
- What is the use of Get-Process command in PowerShell?
- How to get the specific process(es) information using PowerShell?
- How to make MySQL display results in a single line?
- How to use Wait-Process in Powershell?
- How to stop all instances of the process in PowerShell?
- How to get few rows from a Series in Pandas?
- How to stop the specific instance of the process in PowerShell?
- How to confirm before stopping the process in PowerShell?
- How to get all the processes on the local computer with Get-Process command using PowerShell?
- How to get all children of a process using Process API in Java 9?
- How to get supported parameters of the cmdlet in PowerShell?

Advertisements