When cmdlets are executed in PowerShell, the output is an Object, as opposed to only returning text.
This provides the ability to store information as properties.
As a result, handling large amounts of data and getting only specific properties is a trivial task.
As a simple example, the following function retrieves information about storage Devices on a Linux or MacOS operating system platform.
This is accomplished by parsing the output of an existing command, *parted -l* in administrative context, and creating an object from the raw text by using the *New-Object* cmdlet.
Friendly Name NoteProperty string Friendly Name=Msft Virtual Disk (scsi)
Total Size NoteProperty string Total Size= 31.5GB
```
To confirm, we can call the GetType() method interactively from the console.
```PowerShell
PS /home/psuser> $d.GetType()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True Object[] System.Array
```
To index in to the array and return only specific objects, use the square brackets.
```PowerShell
PS /home/psuser> $d[0]
Friendly Name Total Size Device
------------- ---------- ------
Msft Virtual Disk (scsi) 31.5GB /dev/sda
PS /home/psuser> $d[0].GetType()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False PSCustomObject System.Object
```
To return a specific property, the property name can be called interactively from the console.
```PowerShell
PS /home/psuser> $d.Device
/dev/sda
/dev/sdb
```
To output a view of the information other than default, such as a view with only specific properties selected, pass the value to the *Select-Object* cmdlet.
Finally, the example below demonstrates use of the *ForEach-Object* cmdlet to iterate through the array and manipulate the value of a specific property of each object.
In this case the Total Size property, which was given in Gigabytes, is changed to Megabytes.
Alternatively, index in to a position in the array as shown below in the third example.