external help file | Module Name | online version | schema |
---|---|---|---|
ADReportingTools-help.xml |
ADReportingTools |
2.0.0 |
Get AD User information based on category
Get-ADUserCategory [[-Filter] <String>] [-SearchBase <String>] -Category <String> [-Server <String>] [-Credential <PSCredential>] [<CommonParameters>]
Get-ADUserCategory [-Identity] <String> -Category <String> [-Server <String>] [-Credential <PSCredential>] [<CommonParameters>]
Get-ADUserCategory is based on the concept of getting user information from a pre-defined category. For example, you might want to get the properties DisplayName, Name, Title, Department, and Manager for a Department category. The ADReportingTools module will define a set of pre-defined categories that you can reference through $ADUserReportingConfiguration.
These are the current defaults.
Department DisplayName,Name,Title,Department,Manager Basic DisplayName,Name,SamAccountname,UserPrincipalName,Enabled,WhenCreated,WhenChanged Address DisplayName,Name,TelephoneNumber,Office,StreetAddress,POBox,City,State,PostalCode Organization DisplayName,Name,Title,Department,Manager,Company,Office Pwinfo DisplayName,Name,PasswordExpired,PasswordLastSet,PasswordNeverExpires
The user's distinguishedname will always be included.
You don't have to remember what property names to include or reference.
PS C:\> Get-ADUserCategory artd -Category basic
DistinguishedName : CN=ArtD,OU=IT,DC=Company,DC=Pri
DisplayName : Art Deco
Name : ArtD
SamAccountname : ArtD
UserPrincipalName : [email protected]
Enabled : True
WhenCreated : 1/25/2021 1:32:35 PM
WhenChanged : 3/11/2021 6:32:58 PM
PS C:\> Get-ADUserCategory -filter "department -eq 'sales'" -Category Department
DistinguishedName : CN=SamS,OU=Sales,DC=Company,DC=Pri
DisplayName : Sam Smith
Name : SamS
Title :
Department : Sales
Manager : CN=SonyaS,OU=Sales,DC=Company,DC=Pri
DistinguishedName : CN=SonyaS,OU=Sales,DC=Company,DC=Pri
DisplayName : Sonya Smith
Name : SonyaS
Title : Account Executive
Department : Sales
Manager :
DistinguishedName : CN=SamanthaS,OU=Sales,DC=Company,DC=Pri
DisplayName : Samantha Smith
Name : SamanthaS
Title : Sales Assistant
Department : Sales
Manager : CN=SonyaS,OU=Sales,DC=Company,DC=Pri
PS C:\> $ADUserReportingConfiguration += [pscustomobject]@{Name="Custom";Properties="DisplayName","Description"}
PS C:\> Get-ADUserCategory -filter "givenname -like 'a*'" -Category custom
DistinguishedName DisplayName Description
----------------- ----------- -----------
CN=AaronS,OU=Accounting,DC=Company,DC=Pri Aaron Smith Accountant
CN=Al Fresco,OU=Dev,DC=Company,DC=Pri Al Fresco
CN=A.Henaire,OU=Employees,DC=Company,DC=Pri Alexander Henaire
CN=Alfonso Dente,OU=Sales,DC=Company,DC=Pri Alfonso Dente
CN=AndreaS,OU=Accounting,DC=Company,DC=Pri Andrea Smith Accountant
CN=AndyS,OU=Accounting,DC=Company,DC=Pri Andy Smith Accountant
CN=Anthony Stark,OU=Research,DC=Company,DC=Pri Tony Stark
CN=AprilS,OU=IT,DC=Company,DC=Pri April Showers PowerShell Guru
CN=A.Fieldhouse,OU=Employees,DC=Company,DC=Pri Aron Fieldhouse sample user ...
CN=ArtD,OU=IT,DC=Company,DC=Pri Art Deco PowerShell E...
CN=Art Frame,OU=Accounting,DC=Company,DC=Pri Art Frame Test User
The first command is adding a new category. The second command uses the category.
Select a defined category.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specify an alternate credential. This will be used to query the domain and all domain controllers.
Type: PSCredential
Parameter Sets: (All)
Aliases: RunAs
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specify an AD filter like "department -eq 'sales'". The default is all Enabled user accounts.
Type: String
Parameter Sets: filter
Aliases:
Required: False
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Enter an AD user identity
Type: String
Parameter Sets: id
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Enter the distinguished name of the top-level container or organizational unit.
Type: String
Parameter Sets: filter
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specify a domain controller to query for a list of domain controllers.
Type: String
Parameter Sets: (All)
Aliases: dc, domaincontroller
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/