Forum Discussion
bayf-th
Jul 13, 2024Copper Contributor
What happens if you add a user twice to a team using add-teamuser in Powershell?
Hi,
I have the following question: In Powershell using the cmdlet add-teamuser, I can add users to a team. But what happens if you add a user twice to a team? Or in other words: What happens, if you add a user that exists already in the team? Would Powershell ignore the action or would it re-add the user? Would this possibly delete what the user did in the team before (for example his posts or his tasks as a pupil)? Should I check first if the user exists already in the course to avoid possible negative affects?
2 Replies
Sort By
- EWoodrickIron ContributorWouldn't have been easier to just try it?
- bayf-thCopper ContributorI tried to add a user twice to a newly created course. But Powershell didn't tell if it added the user again or if it ignored the cmdlet. I can't see it on admin.microsoft.com either, because I can't see when the user was added. How can I see if Powershell ignores the cmdlet or it adds the user again?
I think it's also not very easy to check if there could be somewhere a problem: I would need to create a test course with a test user and do all different types of actions (solve a homework, correct it, write as a test user posts, upload files...) and afterwards add it again and check if maybe in a single point there could be a problem.
I'll put the question in a different way: If you got a list of users that should be members of a team, is it necessary to write a code to check if the user is already member of the team to avoid possible problems? Or is this unnecessary and a waste of time (Powershell works quite slowly sometimes) because Powershell does this already for you and I can simply write the code to add all these users as members?