Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Get Active Directory User with Specific Attribute

Posted on 2013-12-06
8
Medium Priority
?
1,251 Views
Last Modified: 2013-12-07
I need to get a report of active, meaning not disabled, user accounts and if they have a corresponding attribute called EmployeeID, I've been using the following powershell command, however it does not return a value for employeeID, which when I browse ADSIedit, it is listed as an attribute, some with values and some blank.  What am I missing here?

Get-ADUser -LdapFilter "(&(!useraccountcontrol:1.2.840.113556.1.4.803:=2))" | Select-Object Name,UserPrincipalName,employeeID | Sort-Object UserPrincipalName > C:\export.txt
0
Comment
Question by:fireguy1125
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
8 Comments
 
LVL 57

Expert Comment

by:Mike Kline
ID: 39701781
Try

Get-ADUser -Filter 'enabled -eq $true' -properties * |select-object name, userprincipalname, employeeid

Thanks

Mike
0
 
LVL 57

Expert Comment

by:Mike Kline
ID: 39701795
Just tested in my lab to make sure  I only have one user that has employee id populated

ID
Thanks
Mike
0
 
LVL 1

Author Comment

by:fireguy1125
ID: 39702077
Is there any way to exclude a particular OU from this report?  Specifically the following OU and child OUs beneith it:  COMPANY.COM\Service Accounts

The Service Accounts OU contains 4 OUs beneath it called: Admin, Service, Test, Other
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 57

Accepted Solution

by:
Mike Kline earned 2000 total points
ID: 39702128
Try this

Get-ADUser -Filter 'enabled -eq $true' -properties * |where-object {$_.DistinguishedName      -notlike "*OU=service accounts,DC=company,DC=com*"} | select-object name, userprincipalname, employeeid

Thans

Mike
0
 
LVL 57

Expert Comment

by:Mike Kline
ID: 39702194
Those links really didn't make sense for the follow up question.

Thanks

Mike
0
 
LVL 3

Expert Comment

by:Detlef001
ID: 39702200
I think Mcknife the link that i gave on the option

" Use the PowerShell AD Provider to Modify User Attributes " is the same that describe Get " Active Directory User with Specific Attribute ". If I'm wrong please explain where, so that it would be a learning for me itself.
0
 
LVL 1

Author Closing Comment

by:fireguy1125
ID: 39703162
Exactly what I needed, thanks!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A hard and fast method for reducing Active Directory Administrators members.
Uncontrolled local administrators groups within any organization pose a huge security risk. Because these groups are locally managed it becomes difficult to audit and maintain them.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question