0

Q1. Why does -Properties * not list all properties?

Q2. How can I list all hidden properties of an object, including constructed attributes?

Example 1: Counts

$u = "myUsername"
(Get-ADUser $u -Properties *                                     | Get-Member | Measure-Object).Count
(Get-ADUser $u -Properties *,msDS-UserPasswordExpiryTimeComputed | Get-Member | Measure-Object).Count

#Output:
#211
#212

Example 2: Missing Property

Get-ADUser $u -Properties * | Select msDS-UserPasswordExpiryTimeComputed
Get-ADUser $u -Properties *,msDS-UserPasswordExpiryTimeComputed  | Select msDS-UserPasswordExpiryTimeComputed

#Output:
#msDS-UserPasswordExpiryTimeComputed
#-----------------------------------
#                                   
#133330391314691704  
Steven
  • 13,501
  • 27
  • 102
  • 146
  • Using `*` will make `Get-ADUser` return all properties _that are set_ - it doesn't include unset/empty attribute values unless explicitly requested – Mathias R. Jessen Jun 15 '23 at 20:19
  • Most likely you would need to query the schema to get all possible `user` object class attributes and then use that list on `-Properties` – Santiago Squarzon Jun 15 '23 at 20:45
  • See also: https://superuser.com/a/1739099/447008 – lit Jun 15 '23 at 21:14
  • 1
    @lit, that's the same SU post Santiago previously linked to, and it actually points back to the SO post that this question was now closed as a duplicate of. The sample code in _this_ question suggests that the claim in the linked SU post that specifying _one_ constructed attribute retrieves them _all_ isn't actually true (I've left a comment to that effect there). – mklement0 Jun 15 '23 at 21:35
  • 1
    I'll be fixing that once I confirm to be the same, I left Mr. mklemento a comment back. Always a pleasuring regardless of the feedback reason to hear from the PS greats!! Woo!! – Bitcoin Murderous Maniac Jun 15 '23 at 21:37

0 Answers0