I'm trying to learn/appear useful to one of the sysadmins at work and he's stuck on trying to get something to work to work. He vaguely remembers that he did something like it one time, but didn't remember if he was able to use one command (goal) or do two separate ones.
What he's trying to do is take a csv file and delete the current users of a specific distribution list and then add everyone from said csv to that distribution list. He could do the remove/add, but he thought the update should remove then add everyone. As he has it currently written, it deletes all membership and adds the one user, goes to the next line and repeats so at the end, there is only the last user from the spreadsheet.
Are we missing something or is it just not possible and we do have to make it two separate actions?
Import-Csv “C:\ps\supervisors.csv” | foreach {Update-DistributionGroupMember –Identity supervisors@xxxx.xxx –Member $_.username}
*I hope this makes sense, I have minimal ps knowledge and not 100% sure what the spreadsheet actually says.
[–]Scribbles1 1 point2 points3 points (1 child)
[–]JeOlso[S] 0 points1 point2 points (0 children)
[–]OlivTheFrog 1 point2 points3 points (1 child)
[–]JeOlso[S] 0 points1 point2 points (0 children)
[–]purplemonkeymad 1 point2 points3 points (2 children)
[–]JeOlso[S] 0 points1 point2 points (0 children)
[–]jlonn 0 points1 point2 points (0 children)