Link to home
Start Free TrialLog in
Avatar of Intelli-Seeker
Intelli-SeekerFlag for United States of America

asked on

Powershell: Add EmployeeID to existing Get-ADUser and Get-ADGroup script with multiple lines for each user

This is the working script that I have. I would like to add the EmployeeID attribute for each user but am having trouble with the syntax. The output shows the user and the group name, but does not show the EmployeeID.

Import-Module Activedirectory
Get-ADUser -Filter * -Properties DisplayName,memberof,EmployeeID | % {
 $Name = $_.DisplayName
 $EmployeeID = $_.EmployeeID
  $_.memberof | Get-ADGroup | Select @{N="User";E={$Name}},Name
 } | Export-Csv C:\Reports\Testing\GroupsMultipleLines2.csv -nti

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Intelli-Seeker

ASKER

This is perfect and exactly what our Supervisors need for auditing their users. Thanks a million!