You are currently viewing PowerShell Select-Object Cmdlet

PowerShell Select-Object Cmdlet

PowerShell Select-Object Cmdlet

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In the last blog post, we have discussed New-Object cmdlet in PowerShell.

https://cloudaffaire.com/powershell-new-object-cmdlet/

In this blog post, we will discuss Select-Object cmdlet in PowerShell. You can use Select-Object cmdlet to select specific properties of object in the output. You can further limit the number of results in the output using ‘First’, ‘Last’, Unique’, ‘Skip’, and ‘Index’ parameters. Select-Object also supports optimization where is it stops processing once its reach selection criterion.

Select-Object Cmdlet Syntax:

Select-Object Cmdlet Argument List:

  • ExcludeProperty: Specifies the properties that this cmdlet excludes from the operation.
  • ExpandProperty: Specifies a property to select, and indicates that an attempt should be made to expand that property.
  • First: Specifies the number of objects to select from the beginning of an array of input objects.
  • Index: Selects objects from an array based on their index values.
  • InputObject: Specifies objects to send to the cmdlet through the pipeline.
  • Last: Specifies the number of objects to select from the end of an array of input objects.
  • Property: Specifies the properties to select. These properties are added as NoteProperty members to the output objects.
  • Skip: Skips (does not select) the specified number of items.
  • SkipLast: Skips (does not select) the specified number of items from the end of the list or array.
  • Unique: Specifies that if a subset of the input objects has identical properties and values, only a single member of the subset will be selected.
  • Wait: Indicates that the cmdlet turns off optimization.

PowerShell Select-Object Cmdlet:

Get All Objects Available In A Cmdlet For Selection In PowerShell:

Select Specific Objects From A Cmdlet Output In PowerShell:

Select Top 10 Rows From The Output In PowerShell:

Select Bottom 10 Rows From The Output In PowerShell:

Skip First 100 Rows From The Output In PowerShell:

Select Unique Data In The Output Of PowerShell:

Get Extended Property Of An Object In PowerShell:

Hope you have enjoyed this article. In the next blog post, we will discuss Group-Object cmdlet in PowerShell.

To get more details on PowerShell, kindly follow below official documentation

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about?view=powershell-5.1

 

Leave a Reply