Как посмотреть ou пользователя в ad

от admin

Как посмотреть ou пользователя в ad

How can I find out which OU a User Account belongs to?

I’m using Server 2003. Where can I find the Server 2003 forum?

James A+, Network+, MCP

  • Moved by Bruce-Liu Thursday, June 24, 2010 9:26 AM (From:Windows Server 2008 R2 Management)
  • Changed type Bruce-Liu Thursday, July 8, 2010 9:03 AM

Answers

  • Marked as answer by Bruce-Liu Thursday, July 8, 2010 9:09 AM

All replies

  • Marked as answer by Bruce-Liu Thursday, July 8, 2010 9:09 AM

Please make sure to enable the "Advanced Features" of ADUC so that you can find the Object tab from user’s properties.

Regards Windows Server 2003 issue, please feel free to post to the forum who has not been marked as Windows Server 2008 R2.

On July 1st we will be making Windows Server 2008 R2 Management forum read only. After receiving a lot of feedback from the community, it was decided that this forum is a duplication and therefore redundant of the Management and Windows Power Shell Forum. So, until July 1st, we will start asking customers to redirect their questions to the Management or Windows Power Shell Forum as appropriate. On June 11th, CSS engineers will move any new threads to the Management or Windows Power Shell Forum as appropriate.

How can I determine my user account's OU in a Windows domain?

Is there any way (short of getting an active directory browser) to view my OU while logged in to the domain?

7 Answers 7

UPDATE
You should now use this answer on any kind of modern version of Windows

Here’s a quick VBS script you can use to display your account’s DistinguishedName attribute which contains the OU that your account is in:

EDIT: I should say that it will display the DN of the account in which context the script is run.

Как посмотреть ou пользователя в ad

> Get-ADUser -filter * | Select Name, SamAccountName

> Get-ADUser dmosk -Properties *

> Get-ADUser -filter * -Properties title | where | Select Name

> Get-ADUser -filter * | Where

Выгрузка пользователей в CSV (для просмотра в текстовом формате или Excel)

Get-ADUser -filter * -Properties * | Export-csv -path C:\Temp\ADUsers.csv

Get-ADUser -filter * -SearchBase «OU=Пользователи,DC=dmosk,DC=local» -Properties mobile, mail | Select Name, mobile, mail | Export-csv -Encoding UTF8 -Delimiter «;» -path C:\Temp\UserPhoneAndEmail.csv

Get-AdUser dmosk -Properties memberof | Select memberof -expandproperty memberof

Get-ADOrganizationalUnit in Active Directory – PowerShell

PowerShell Get-ADOrganizationalUnit cmdlet gets one or more active directory Organizational Unit (OU). Get-ADOrganizationalUnit Filter parameter gets multiple OU based on search criteria.

Get-AdOrganizationalUnit Description

In this article, I will explain how to use PowerShell Get-ADOrganizationalUnit with additional properties to a specific organizational unit or multiple OU’s in PowerShell.

Get-ADOrganizationalUnit Syntax

PowerShell Get-ADOrganizationalUnit active directory cmdlet retrieves information about one or more organizational units (OU) in the active directory.

Let’s understand each of the get adorganizationalunit key parameters as below:

AuthType – authentication method to use based on either Basic (or 1) or Negotiate (or 0). It has Negotiate default authentication method.

SSL (Secure Socket Layer) connection is required to use the Basic Authentication method.

Credential PSCredential – It specifies user credentials required to perform a Get-ADGroup search for the group. It default accepts the credentials of logged-on users.

To use the Credential parameter, use username as User1 or domain\User1 or you can create and use PSCredential object by using Get-Credential cmdlet.

-Identity – It specifies Active Directory group object to get OU search using the distinguished name, GUID, security identifier or SAMAccountName

-Partition – It specifies the distinguished name of an active directory partition.

Filter – It specifies a query string (PowerShell Expression Language Syntax) to retrieves Active Directory objects. PowerShell wildcards other than * are not supported by filter syntax.

-LDAPFilter – LDAPFilter query string is used to filter Active Directory objects.

-Properties – Use this parameter to get all properties for an OU object. Use Properties * (asterisk) to display organizational unit all attributes.

Using Get-ADOrganizationalUnit Filter parameter (wildcard)

If you want to search for a specific organizational unit or multiple OU’s in the active directory, use filter or LDAPFilter.

Читать:
Appex accelerator ui что это

Get-ADOrganizationalUnit filter parameter with a wildcard (asterisk) for search and lists all OU’s available in Active Directory

In the above Get-ADOrganizationalUnit Filter parameter with wild character (*) gets organizational units with their distinguished name available in the domain.

Filter parameter uses PowerShell expression language to write query string for Active Directory.

The output of the above command to get organizational units with distinguished names is:

Get-ADOrganizationalUnit - distinguishedName

Get-ADOrganizationalUnit – distinguishedName

Cool Tip: How to create an Organizational Unit in PowerShell!

Let’s understand PowerShell Active Directory Get-ADOrganizationalUnit examples.

Get Adorganizational Unit by Name

OrganizationUnit in the active directory can be get using the Get-AdOrganizationalUnit Name property. You can specify the OU name with the Filter parameter to search effectively for the OU name in your active directory.

To get OU details by name from the active directory, use the following command

The output of the above command get the organizational unit by name as

Get-ADOrganizationalUnit to Get all OUs in a Domain

To get all OUs in the domain, run the following command

In the above PowerShell Get-ADOrganizationalUnit Filter parameter with search condition where organizational name like “*” (wildcard) gets organizational unit distinguishedName and their name from the domain.

The output of above using the get-adorganizationalunit command is:

Get-ADOrganizationalUnit to Get OU from Distinguished Name

If you want to get an OU from a distinguished name, run the following command

In the above PowerShell script, Get-ADOrganizationalUnit uses the Identity parameter to specify an organizational unit distinguished name.

It gets ad organizational unit from distinguished name and format results parameters to table as below

Cool Tip: how to get-aduser using userprincipalname in PowerShell!

Get-AdOrganizationalUnit Canonical Name

Using the CanonicalName property of Get-AdOrganizationalUnit, you can get a list of organizational units’ canonical names.

In the above PowerShell script, it uses the Get-AdOrganizationalUnit Filter parameter with wildcard character * gets all OU in the domain.

Get-AdOrganizationalUnit uses CanonicalName property to get active directory organizational unit canonical name.

The output of the above command is:

Get-AdOrganizationalUnit Canonical Name

Get-AdOrganizationalUnit Canonical Name

Export OrganizationalUnits from Active Directory to CSV file

Using the Get-AdOrganizationalUnit Filter * parameter, it gets all the OUs from the active directory.

Use the Export-CSV cmdlet in PowerShell to export OU from the Active Directory to the CSV file.

The output of the above PowerShell script to export active directory ous as follows:

Export ou from the Active Directory

Export ou from the Active Directory

Cool Tip: how to export active directory users to the CSV file in PowerShell!

Get AdOrganizationalUnit All Properties

Get-AdOrganizationalUnit retrieves a default set of properties. To get additional organizational unit properties, use -Properties parameter.

To get adorganizationalunit extended properties for OU name specified by distinguished name, run the following command

Get Sub OU Description within a OU

Using the Get-AdorganizationalUnit SearchScope OneLevel parameter, it searches the immediate children of the given OU.

In the following script to get sub ous and their distinguishedname and name, the $OU variable contains the current path of the OU.

Get-AdOrganizationalUnit uses the SearchBase parameter to search within the given OU and SearchBase OneLevel to get sub ou.

The output of the above command to get a list of sub ou and their description as given:

Get sub ou description in given ou

Get sub ou description in given ou

Conclusion

I hope the above article on using PowerShell Get-ADOrganizationalUnit cmdlet to get one or more Organizational Units (OU) in the active directory.

Using the Get-AdOrganizational Filter parameter, you can get all organizational units and their distinguished name or get specific OU available in the domain.

Use the Get AdOrganizationalUnit Identity parameter to get OU from the distinguished name available in the domain.

Get-ADOrganizationalUnit returns a default set of properties. To get additional properties of OU, use -Properties parameter.

You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.

Похожие статьи