Trying to Import csv\txt file with just employeeNumber column. To Add Active Directory Accounts to a Distribution Group in Active Directory

Appreciate any help with this..

txt file example:

"employeeNumber"
"000088"
"000102"
"002599"
"007169"
"008938"
"009026"
"009164"
"075718"
"075506"

sample script but we are a google shop do not have exchange, and every time I run it. Script is unable to recognize employeeNumber attribute.

$Path = "c:\Test\BonusUsers.csv"

ForEach ($Emp in (Import-Csv $Path))
{   $EmpID = $Emp.employeeNumber
    $User = Get-ADUser -Filter {employeeNumber -eq $EmpID} 
    If ($User)
    {   
$User | Add-ADGroupMember -Identity "Bonus_List" -Members $EmpID } }
Parents Reply Children
No Data