Jawloms Posted September 13, 2022 Posted September 13, 2022 (edited) I need to add a user to a couple of hundred teams. Anything I Google just comes back with adding multiple users to A team, which is round the wrong way. I've had a go at editing an existing script but just couldn't get the syntax correct. I have all the Teams I need her in, in a CSV file. Thank you Stuart Edited September 13, 2022 by Jawloms
PureDarkStar Posted September 13, 2022 Posted September 13, 2022 Hi Stuart, this is what I've been using, the CSV just needs two columns with the headings GroupID and Member #Get Credentials to connect$Credential = Get-Credential #Connect to Exchange OnlineConnect-ExchangeOnline -Credential $Credential -ShowBanner:$False #PowerShell to Import Members to office 365 group from CSVImport-CSV "C:\Temp\XXX.csv" | ForEach-Object { Add-UnifiedGroupLinks -Identity $_.GroupID -LinkType Members -Links $_.Member Write-host -f Green "Added Member '$($_.Member)' to Office 365 Group '$($_.GroupID)'"} #Disconnect Exchange OnlineDisconnect-ExchangeOnline -Confirm:$False 1
Jawloms Posted September 13, 2022 Author Posted September 13, 2022 Thanks for that, but it's connecting to Exchange online which we don't currently use. I set all my Teams up using Import-Module MicrosoftTeams and Connect-MicrosoftTeams. Would it still work using Exchange online commands for me?
Aprice Posted September 13, 2022 Posted September 13, 2022 This is one of the scripts I wrote for ours: Connect-MicrosoftTeams $Roster = import-Csv \\Itoffice-pc01\c$\File.csv ForEach ($Student in $Roster) { Get-Team -DisplayName $Student.Team | Add-TeamUser -User $Student.UserPrincipalName -Role Member } From memory two columns one names Team with the team name and UserPrincipalName as the headers. 1
psydii Posted September 13, 2022 Posted September 13, 2022 TBH A Team is an UnifiedGroup, so you are using Exchange Online, even if that isn't where your user mailboxes are stored. If you really want to use the microsoftteams module though, you just need to tweak script, swapping out add-UnifiedGroupLinks for add-teamuser edit: ninja'd 1
Norphy Posted September 13, 2022 Posted September 13, 2022 Just bear in mind that doing this will absolutely destroy the performance of the Teams client. I remember adding being asked to add teachers to every class team in their subject or year, then being asked to take them out again very soon afterwards. 1
Jawloms Posted September 13, 2022 Author Posted September 13, 2022 We don't use the client, we get everyone to use it browser based. Does it affect performance in there too?
Norphy Posted September 13, 2022 Posted September 13, 2022 I don't ever recall checking to be honest, but considering that the fat client is essentially a wrapper for the browser client in Electron I would expect similar problems, yes. 2
Jawloms Posted September 13, 2022 Author Posted September 13, 2022 OK, thanks. She's a cover teacher so she wanted to go in to all Teams "in case". I'll put her in but warn her it may be slow......
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now