Intelli-Seeker
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER