Does computer PC Discovery pull the OU data?

David77
Giga Guru

Our desktop field support teams utilize the OU (Organization Unit) data as part of their daily work. 

When we Discover PCs, we don't see that the OU data is being collected and stored in the CMDB - is that true?

Has anyone modified their Discovery code to gather the OU, or suggested this idea to ServiceNow?

Thanks!

4 REPLIES 4

VivekSattanatha
Mega Sage
Mega Sage

Hi,

 

I believe you meant to OU data from active directory which is not stored on the device itself. You need to get it from AD.

Using LDAP integration in the past we have pulled that computer object information from AD and stored it on the CI level.

 

Regards,

Vivek

Anshu_Anand_
Kilo Sage
Kilo Sage

In discovery extension of windows, you need to use run command to get all OU from target system

Get-ADOrganizationalUnit -Filter 'Name -like "*"' | Format-Table Name, DistinguishedName -A

Get-ADOrganizationalUnit -Filter 'Name -like "*"' | Format-Table Name, DistinguishedName -A

Name                 DistinguishedName
----                 -----------------
Domain Controllers   OU=Domain Controllers,DC=FABRIKAM,DC=COM
UserAccounts         OU=UserAccounts,DC=FABRIKAM,DC=COM
Sales                OU=Sales,OU=UserAccounts,DC=FABRIKAM,DC=COM
Marketing            OU=Marketing,OU=UserAccounts,DC=FABRIKAM,DC=COM
Production           OU=Production,OU=UserAccounts,DC=FABRIKAM,DC=COM
HumanResources       OU=HumanResources,OU=UserAccounts,DC=FABRIKAM,DC=COM
NorthAmerica         OU=NorthAmerica,OU=Sales,OU=UserAccounts,DC=FABRIKAM,DC=COM
SouthAmerica         OU=SouthAmerica,OU=Sales,OU=UserAccounts,DC=FABRIKAM,DC=COM
Europe               OU=Europe,OU=Sales,OU=UserAccounts,DC=FABRIKAM,DC=COM
AsiaPacific          OU=AsiaPacific,OU=Sales,OU=UserAccounts,DC=FABRIKAM,DC=COM
Finance              OU=Finance,OU=UserAccounts,DC=FABRIKAM,DC=COM
Corporate            OU=Corporate,OU=UserAccounts,DC=FABRIKAM,DC=COM
ApplicationServers   OU=ApplicationServers,DC=FABRIKAM,DC=COM
Groups               OU=Groups,OU=Managed,DC=FABRIKAM,DC=COM
PasswordPolicyGroups OU=PasswordPolicyGroups,OU=Groups,OU=Managed,DC=FABRIKAM,DC=COM
Managed              OU=Managed,DC=FABRIKAM,DC=COM
ServiceAccounts      OU=ServiceAccounts,OU=Managed,DC=FABRIKAM,DC=COM

Get an OU by its distinguished name

Get-ADOrganizationalUnit -LDAPFilter '(name=*)' -SearchBase 'OU=Sales,OU=UserAccounts,DC=FABRIKAM,DC=COM' -SearchScope OneLevel | Format-Table Name,Country,PostalCode,City,StreetAddress,State

Name                    Country                 PostalCode             City                   StreetAddress          State
----                    -------                 ----------             ----                   -------------          -----
AsiaPacific             AU                      4171                   Balmoral               45 Martens Place       QLD
Europe                  UK                      NG34 0NI               QUARRINGTON            22 Station Rd
NorthAmerica            US                      02142                  Cambridge              1634 Randolph Street   MA

 

Hope its helpful

Regards,
Anshu

Thanks! I'll look into this and mark as correct after some testing!

David77
Giga Guru

Finally got time to work on this, when I copy/paste the command into the extension Operation window it flags it like this "put a dollar sign in front of variable names, use a plus sign to combine constants or variables.  The command is

"powershell Get-ADOrganizationalUnit -Filter 'Name -like "*"' | Format-Table Name, DistinguishedName -A"

 

If i shorten the commnd to simply: "powershell Get-ADOrganizationalUnit " then it returns

 

find_real_file.png