Windows PowerShell command on Get-command Select-Object
MyWebUniversity

Windows PowerShell command on Get-command Select-Object

NAME

Select-Object

SYNOPSIS

Selects objects or object properties.

SYNTAX

Select-Object [[-Property] ] [-ExcludeProperty ] [-ExpandProperty ] [-First ]

[-InputObject ] [-Last ] [-Skip ] [-Unique] [-Wait] []

Select-Object [[-Property] ] [-ExcludeProperty ] [-ExpandProperty ] [-InputObject

] [-SkipLast ] [-Unique] []

Select-Object [-Index ] [-InputObject ] [-Unique] [-Wait] []

DESCRIPTION

The Select-Object cmdlet selects specified properties of an object or set of objects. It can also select unique

objects, a specified number of objects, or objects in a specified position in an array. To select objects from a collection, use the First , Last , Unique , Skip , and Index parameters. To select object

properties, use the Property parameter. When you select properties, Select-Object returns new objects that have

only the specified properties.

Beginning in Windows PowerShell 3.0, Select-Object includes an optimization feature that prevents commands from

creating and processing objects that are not used. When you include a Select-Object command with the First or

Index parameter in a command pipeline, Windows PowerShell stops the command that generates the objects as soon as the selected number of objects is generated, even when the command that generates the objects appears before the

Select-Object command in the pipeline. To turn off this optimizing behavior, use the Wait parameter.

PARAMETERS

-ExcludeProperty

Specifies the properties that this cmdlet excludes from the operation. Wildcards are permitted. This parameter is effective only when the command also includes the Property parameter. Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false

-ExpandProperty

Specifies a property to select, and indicates that an attempt should be made to expand that property. Wildcards are permitted in the property name. For example, if the specified property is an array, each value of the array is included in the output. If the property contains an object, the properties of that object are displayed in the output. Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false

-First

Gets only the specified number of objects. Enter the number of objects to get. Required? false Position? named Default value False Accept pipeline input? False Accept wildcard characters? false

-Index

Specifies an array of objects based on their index values. Enter the indexes in a comma-separated list.

Indexes in an array begin with 0, where 0 represents the first value and (n-1) represents the last value.

Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false

-InputObject

Specifies objects to send to the cmdlet through the pipeline. This parameter enables you to pipe objects to

Select-Object .

When you use the InputObject parameter with Select-Object , instead of piping command results to Select-Object

, the InputObject value-even if the value is a collection that is the result of a command, such as

`-InputObject (Get-Process)`-is treated as a single object. Because InputObject cannot return individual

properties from an array or collection of objects, it is recommended that if you use Select-Object to filter a

collection of objects for those objects that have specific values in defined properties, you use Select-Object

in the pipeline, as shown in the examples in this topic. Required? false Position? named Default value None Accept pipeline input? True (ByValue) Accept wildcard characters? false

-Last

Specifies the number of objects to select from the end of an array of input objects. Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false

-Property

Specifies the properties to select. Wildcards are permitted. The value of the Property parameter can be a new calculated property. To create a calculated, property, use a hash table. Valid keys are:

- Name (or Label)

- Expression or