Forum Discussion
Eve_X
Jan 20, 2023Copper Contributor
Add a user to multiple channels via Powershell
Hi, I'm trying to customize a Powershell script to add one user to multiple channels at once. It will save a lot of work when there's a new employee. This is my original script: $channels = ...
VasilMichev
Jan 20, 2023MVP
Space should not be a problem, and it should work even if you don't add the quotes. I'd suggest double-checking the channel name itself.
Eve_X
Jan 20, 2023Copper Contributor
Thanks Vasil,
I have figured out it myself by switching to the cmdlets below:
$channels = Import-Csv -Path “C:\Users\Administrator\Desktop\channels.csv”
foreach ($channel in $channels)
{
$displayname = $channel.Channel
Add-TeamChannelUser -GroupId $channel.groupid -DisplayName "$displayname" -user <>
}
But thanks anyway!
I have figured out it myself by switching to the cmdlets below:
$channels = Import-Csv -Path “C:\Users\Administrator\Desktop\channels.csv”
foreach ($channel in $channels)
{
$displayname = $channel.Channel
Add-TeamChannelUser -GroupId $channel.groupid -DisplayName "$displayname" -user <>
}
But thanks anyway!