Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Monday, July 9, 2018 10:59 AM
Am new to powershell. I need to get few attributes like title & department for few users attached in the text file.
I tried with the below command but no luck.
PS C:\> get-aduser -f * -Searchbase "ou=powershell,dc=contoso,dc=com" -pr SamAccountName,PasswordExpired,whenChanged,UserPrincipalName
All replies (3)
Monday, July 9, 2018 11:05 AM | 1 vote
You have to add them to the properties list.
help Get-AdUser -online
Read the whole help carefully.
\(ツ)_/
Monday, July 9, 2018 11:51 AM
Try this to get all properties
get-aduser -f * -Searchbase "ou=powershell,dc=contoso,dc=com" -properties *|select -first 1
and this to select your properties
get-aduser -f * -Searchbase "ou=powershell,dc=contoso,dc=com" -properties titel,department
Toni
Monday, July 9, 2018 12:53 PM
Great thanks a lot for your help the select properties works fine for me..
get-aduser -f * -Searchbase "ou=powershell,dc=contoso,dc=com" -properties titel,department