external help file | Module Name | online version | schema |
---|---|---|---|
ADReportingTools-help.xml |
ADReportingTools |
2.0.0 |
Get a listing of members in an AD branch.
Get-ADBranch [-SearchBase] <String> [-ObjectClass <String[]>]
[-IncludeDeletedObjects] [-ExcludeContainers] [-Server <String>]
[-Credential <PSCredential>] [<CommonParameters>]
This command will get all users, groups, and computers from a given Active Directory organizational unit or container and display a hierarchical report. The search is recursive from the starting search base.
PS C:\> Get-ADBranch "OU=IT,DC=company,DC=pri"
DistinguishedName Name Description
----------------- ---- -----------
CN=AprilS,OU=IT,DC=Company,DC=Pri AprilS PowerShell Guru
Branch: OU=It,DC=Company,DC=Pri [User]
DistinguishedName Name Description
----------------- ---- -----------
CN=ArtD,OU=IT,DC=Company,DC=Pri ArtD PowerShell Engineer
CN=GladysK,OU=IT,DC=Company,DC=Pri GladysK Senior AD and Ide...
CN=MaryL,OU=IT,DC=Company,DC=Pri MaryL Main IT
CN=MikeS,OU=IT,DC=Company,DC=Pri MikeS Backup IT
Branch: OU=It,DC=Company,DC=Pri [Group]
DistinguishedName Name Description
----------------- ---- -----------
CN=IT,OU=IT,DC=Company,DC=Pri IT
CN=Web Servers,OU=IT,DC=Company,DC=Pri Web Servers
...
Get members of the IT organizational unit. There is a formatting bug where the first item isn't properly grouped.
PS C:\> Get-ADBranch "Ou=accounting,Dc=company,dc=pri" -objectclass group
DistinguishedName Name Description
----------------- ---- -----------
CN=Accounting,OU=Accounting, Accounting Company Accounting DC=Company,DC=Pri
Branch: OU=Corp Investment,OU=Finance,OU=Accounting,DC=Company,DC=Pri [Group]
DistinguishedName Name Description
----------------- ---- -----------
CN=StrategyDL,OU=Corp StrategyDL Strategic plann... Investment,OU=Finance,OU=Accounting,
DC=Company,DC=Pri
Branch: OU=Payroll,OU=Accounting,DC=Company,DC=Pri [Group]
DistinguishedName Name Description
----------------- ---- -----------
CN=Payroll Managers,OU=Payroll, Payroll Managers
OU=Accounting,DC=Company,DC=Pri
Get only groups in the Accounting OU tree.
Specify an alternate credential.
Type: PSCredential
Parameter Sets: (All)
Aliases: RunAs
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Show deleted objects. This parameter has no effect unless you are searching from the domain root.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
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: (All)
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specify a domain controller to query.
Type: String
Parameter Sets: (All)
Aliases: dc, domaincontroller
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Exclude containers like USERS. This will only have no effect unless your search base is the domain root.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Only show objects of the matching classes. Valid choices are user, group, and computer.
Type: String[]
Parameter Sets: (All)
Aliases:
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/