Don’t do that #8: Get all properties instead of specific one

By | March 20, 2015

Don’t do that: The following command retrieves all the properties for a user although only the property “PasswordLastSet” is required:

Get-ADUser -Identity $user -Properties * | Select-Object -Property PasswordLastSet


Do that: It’s better and faster to retrieve only the property “PasswordLastSet” (we only need this one).

With very large queries, the difference between “-Properties *” and “-Properties PasswordLastSet” can make a significant difference.

(Get-ADUser -Identity $user -Properties PasswordLastSet).PasswordLastSet


previous-buttonnext-button

Leave a Reply

Your email address will not be published.