# Use multiple Select-Object Expressions

**URL:** <https://forums.powershell.org/t/use-multiple-select-object-expressions/20717>\
**Category:** PowerShell Help\
**Created:** [October 21, 2022, 5:23pm UTC](https://forums.powershell.org/t/use-multiple-select-object-expressions/20717 "2022-10-21T17:23:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![D-a-n\_L](https://avatars.discourse-cdn.com/v4/letter/d/ee59a6/32.png) [@D-a-n\_L](https://forums.powershell.org/u/D-a-n_L)\
**Post date:** [October 21, 2022, 5:23pm UTC](https://forums.powershell.org/t/use-multiple-select-object-expressions/20717/1 "2022-10-21T17:23:08Z")

</div>

ForEach-Object {Get-ADUser -Filter “EmployeeID -eq ‘$($\_.EID)’” -Properties Displayname, LastLogon, LastLogonDate, LastLogonTimeStamp, EmployeeID } |  
Select-Object DisplayName, SamAccountName, Enabled, LastLogon, LastLogonDate,

@{Name=“LastLogonTimeStamp”; Expression={[DateTime]::FromFileTime($_.lastLogonTimestamp)}  
@{Name=“LastLogon”; Expression={[DateTime]::FromFileTime($_.lastLogon) }

How do I use two select-object expressions?

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [October 21, 2022, 5:32pm UTC](https://forums.powershell.org/t/use-multiple-select-object-expressions/20717/2 "2022-10-21T17:32:49Z")

</div>

P l e a s e format your code as code. I know you know how to do because you already did in the past. 😉

> [@D-a-n\_L](#):
>
> How do I use two select-object expressions?

If your question is how you use 2 or more calculated properties - you simply use them like any other property - you separate them with commas!? 🤷🏽‍♂️

You should ALWAYS read the help for the cmdlets you’re about to use completely including the examples to learn how to use them.

Pay attention to the example 11

> **[Select-Object (Microsoft.PowerShell.Utility) - PowerShell](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/select-object?view=powershell-7.2#example-11-create-calculated-properties-for-each-inputobject)**
>
> 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...

… and you can use them for more than just `Select-Object`

> **[about Calculated Properties - PowerShell](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_calculated_properties?view=powershell-7.2)**
>
> PowerShell provides the ability to dynamically add new properties and alter the formatting of objects output to the pipeline.

---

<div class="post-metadata">

**Author:** ![D-a-n\_L](https://avatars.discourse-cdn.com/v4/letter/d/ee59a6/32.png) [@D-a-n\_L](https://forums.powershell.org/u/D-a-n_L)\
**Post date:** [October 21, 2022, 6:38pm UTC](https://forums.powershell.org/t/use-multiple-select-object-expressions/20717/3 "2022-10-21T18:38:09Z")

</div>

Viola! Example 11 did it. You have no idea how your feedback forces me to learn and get better at this. Thank you.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:16pm UTC](https://forums.powershell.org/t/use-multiple-select-object-expressions/20717/4 "2024-05-16T20:16:30Z")

</div>


