{"id":78675,"date":"2026-05-24T20:03:38","date_gmt":"2026-05-24T20:03:38","guid":{"rendered":"http:\/\/bangla.sitestree.com\/?p=78675"},"modified":"2026-05-24T20:03:38","modified_gmt":"2026-05-24T20:03:38","slug":"explain-the-command-and-each-part-get-service-select-object-status-displayname-where-object-_-status-eq-running-and-_-displayname-like-windows-sort-object-displayna","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=78675","title":{"rendered":"Explain the command and each part : Get-Service * | Select-Object Status, DisplayName | Where-Object { $_.Status -eq &#8220;Running&#8221; -and $_.DisplayName -like &#8220;Windows*\u201c } | Sort-Object DisplayName -Descending | Format-Table -AutoSize"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This command lists <strong>running Windows services whose display name starts with \u201cWindows\u201d<\/strong>, sorts them by display name in descending order, and displays the result in a neat table.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Corrected version:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Get-Service * |\nSelect-Object Status, DisplayName |\nWhere-Object { $_.Status -eq \"Running\" -and $_.DisplayName -like \"Windows*\" } |\nSort-Object DisplayName -Descending |\nFormat-Table -AutoSize\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step-by-step explanation<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. <code>Get-Service *<\/code><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>Get-Service *\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Gets all Windows services on the computer.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>*<\/code> wildcard means:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>all services\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">So this returns services such as:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Windows Update\nWindows Audio\nPrint Spooler\nBITS\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">2. Pipeline <code>|<\/code><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>|\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The pipeline sends the output of one command to the next command.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here, service objects are passed from:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Get-Service\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">to:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Select-Object\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">3. <code>Select-Object Status, DisplayName<\/code><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>Select-Object Status, DisplayName\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Keeps only two properties:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Property<\/th><th>Meaning<\/th><\/tr><\/thead><tbody><tr><td><code>Status<\/code><\/td><td>Whether the service is Running, Stopped, etc.<\/td><\/tr><tr><td><code>DisplayName<\/code><\/td><td>The friendly service name shown to users<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Example output at this stage:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Status   DisplayName\n------   -----------\nRunning  Windows Audio\nStopped  Windows Search\nRunning  Windows Update\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">4. <code>Where-Object { ... }<\/code><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>Where-Object { $_.Status -eq \"Running\" -and $_.DisplayName -like \"Windows*\" }\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This filters the services.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Only services that meet <strong>both<\/strong> conditions are kept.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">5. <code>$_<\/code><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>$_\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Means:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>the current object in the pipeline\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In this command, each <code>$_<\/code> represents one service object.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">6. <code>$_.Status -eq \"Running\"<\/code><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>$_.Status -eq \"Running\"\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Checks whether the service status is exactly:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Running\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>-eq<\/code> means:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>equals\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">7. <code>-and<\/code><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>-and\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Means both conditions must be true.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So the service must be:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Running\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">and its display name must start with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Windows\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">8. <code>$_.DisplayName -like \"Windows*\"<\/code><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>$_.DisplayName -like \"Windows*\"\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Checks whether the service display name starts with <code>Windows<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>-like<\/code> is used for wildcard pattern matching.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>*<\/code> means:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>anything after Windows\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Examples that match:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Windows Audio\nWindows Update\nWindows Event Log\nWindows Search\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Examples that do not match:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Print Spooler\nBackground Intelligent Transfer Service\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">9. <code>Sort-Object DisplayName -Descending<\/code><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>Sort-Object DisplayName -Descending\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Sorts the remaining services by <code>DisplayName<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>-Descending<\/code> means:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Z to A\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Without <code>-Descending<\/code>, it would sort:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>A to Z\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">10. <code>Format-Table -AutoSize<\/code><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>Format-Table -AutoSize\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Displays the final output as a table.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>-AutoSize<\/code> adjusts column widths so the output is easier to read.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Full meaning in one sentence<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>Get-Service * |\nSelect-Object Status, DisplayName |\nWhere-Object { $_.Status -eq \"Running\" -and $_.DisplayName -like \"Windows*\" } |\nSort-Object DisplayName -Descending |\nFormat-Table -AutoSize\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">means:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Get all services, keep only Status and DisplayName, filter only running services whose display name starts with \u201cWindows\u201d, sort them by DisplayName from Z to A, and display the result in a neat table.<\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">Important note<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Your original command has a curly closing quote here:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\"Windows*\u201c\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Use a normal straight quote instead:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\"Windows*\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">REF: AI Tools\/ChatGPT<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This command lists running Windows services whose display name starts with \u201cWindows\u201d, sorts them by display name in descending order, and displays the result in a neat table. Corrected version: Step-by-step explanation 1. Get-Service * Gets all Windows services on the computer. The * wildcard means: So this returns services such as: 2. Pipeline | &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=78675\">Continue reading<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1981],"tags":[],"class_list":["post-78675","post","type-post","status-publish","format-standard","hentry","category-power-shell","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":78104,"url":"http:\/\/bangla.sitestree.com\/?p=78104","url_meta":{"origin":78675,"position":0},"title":"PowerShell : Check the Block Size of a Drive","author":"Sayed","date":"May 8, 2025","format":false,"excerpt":"Command: Get-CimInstance -ClassName Win32_Volume | Select-Object Name, FileSystem, Label, Size, BlockSize | Sort-Object Name | Format-Table -AutoSize Sample Output: Needed to format a 1TB Memory Card. 64 KB seemed to be a good Block Size for general use. Windows by default did not give an option to select a smaller\u2026","rel":"","context":"In &quot;Root&quot;","block_context":{"text":"Root","link":"http:\/\/bangla.sitestree.com\/?cat=1"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/05\/image-4.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/05\/image-4.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/05\/image-4.png?resize=525%2C300 1.5x, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/05\/image-4.png?resize=700%2C400 2x"},"classes":[]},{"id":78665,"url":"http:\/\/bangla.sitestree.com\/?p=78665","url_meta":{"origin":78675,"position":1},"title":"Explain: Get-Process | Select Name,Id,CPU | Sort CPU -Descending","author":"Sayed","date":"May 24, 2026","format":false,"excerpt":"This command shows running processes with selected columns and sorts them by CPU usage\/time. Get-Process | Select Name,Id,CPU | Sort CPU -Descending Meaning step by step 1. Get-Process Get-Process Gets all running processes on the computer. 2. Pipeline | | Passes the process objects to the next command. 3. Select\u2026","rel":"","context":"In &quot;Power Shell&quot;","block_context":{"text":"Power Shell","link":"http:\/\/bangla.sitestree.com\/?cat=1981"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":78667,"url":"http:\/\/bangla.sitestree.com\/?p=78667","url_meta":{"origin":78675,"position":2},"title":"Variations of: Get-Process | Select Name,Id,CPU | Sort CPU -Descending","author":"Sayed","date":"May 24, 2026","format":false,"excerpt":"Yes. These commands produce the same type of output: process Name, Id, and CPU, sorted by CPU in descending order. Variation 1: Full cmdlet names Get-Process | Select-Object -Property Name, Id, CPU | Sort-Object -Property CPU -Descending Variation 2: Sort first, then select Get-Process | Sort-Object -Property CPU -Descending |\u2026","rel":"","context":"In &quot;Power Shell&quot;","block_context":{"text":"Power Shell","link":"http:\/\/bangla.sitestree.com\/?cat=1981"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":78669,"url":"http:\/\/bangla.sitestree.com\/?p=78669","url_meta":{"origin":78675,"position":3},"title":"Command performs the full setup of a new RAW disk in one PowerShell pipeline:","author":"Sayed","date":"May 24, 2026","format":false,"excerpt":"explain: Get-Disk | Where PartitionStyle -eq \"RAW\" | Initialize-Disk -PartitionStyle GPT -PassThru | New-Partition -UseMaximumSize -AssignDriveLetter | Format-Volume -FileSystem NTFS -NewFileSystemLabel \"MYDATA\" This command performs the full setup of a new RAW disk in one PowerShell pipeline: Get-Disk | Where PartitionStyle -eq \"RAW\" | Initialize-Disk -PartitionStyle GPT -PassThru | New-Partition\u2026","rel":"","context":"In &quot;Power Shell&quot;","block_context":{"text":"Power Shell","link":"http:\/\/bangla.sitestree.com\/?cat=1981"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":78659,"url":"http:\/\/bangla.sitestree.com\/?p=78659","url_meta":{"origin":78675,"position":4},"title":"GPT in PowerShell","author":"Sayed","date":"May 24, 2026","format":false,"excerpt":"Ref: AI Tool\/ChatGPT GPT in Disk Management GPT means GUID Partition Table. It is a modern disk partitioning system used to organize partitions on a hard drive, SSD, or virtual disk. In PowerShell disk management, you may see it here: Get-Disk Example output: Number FriendlyName PartitionStyle ------ ------------ -------------- 0\u2026","rel":"","context":"In &quot;Operating Systems&quot;","block_context":{"text":"Operating Systems","link":"http:\/\/bangla.sitestree.com\/?cat=1968"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":78661,"url":"http:\/\/bangla.sitestree.com\/?p=78661","url_meta":{"origin":78675,"position":5},"title":"Power Shell: explain: Get-Disk | Where PartitionStyle -eq &#8220;RAW&#8221; | Initialize-Disk -PartitionStyle GPT","author":"Sayed","date":"May 24, 2026","format":false,"excerpt":"This command finds uninitialized disks and initializes them using the GPT partition style: Get-Disk | Where PartitionStyle -eq \"RAW\" | Initialize-Disk -PartitionStyle GPT Step-by-step explanation 1. Get-Disk Get-Disk Lists disks connected to the system. It shows information such as: Number FriendlyName OperationalStatus Size PartitionStyle 2. Where PartitionStyle -eq \"RAW\" Where\u2026","rel":"","context":"In &quot;Power Shell&quot;","block_context":{"text":"Power Shell","link":"http:\/\/bangla.sitestree.com\/?cat=1981"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/78675","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=78675"}],"version-history":[{"count":1,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/78675\/revisions"}],"predecessor-version":[{"id":78676,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/78675\/revisions\/78676"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=78675"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=78675"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=78675"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}