-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMicrosoftTeamsUsers1.ps1
More file actions
46 lines (31 loc) · 1.51 KB
/
MicrosoftTeamsUsers1.ps1
File metadata and controls
46 lines (31 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# ***** Must launch Powershell ISE as admin of computer *****
Install-Module -Name MicrosoftTeams -Force -AllowClobber
Update-Module MicrosoftTeams
Import-Module MicrosoftTeams
Connect-MicrosoftTeams
# Add Users and number to array.
$users = @{
"John.Doe" = 1234567890;
"Jack.Smith" = 0987654321;
}
#Loop thru Array of users and number and set the user to enterprise voice and set phone number.
ForEach ($user in $users.Keys) {
$key = $user
$value = $users["$user"]
# Add E164 format
$value = "+1$value"
Write-Output $key
Write-Output $value
Get-CsOnlineUser $key | Select alias,userprincipalname,samaccountname,interpret*,*voice*,*lineuri*,*dial*,*hosting*,*sip*,displayname
# Old Command no longer needed
#Grant-CsTeamsUpgradePolicy -PolicyName UpgradeToTeams -Identity $key
#Write-Output "tel:+1$value"
Set-CsUser -Identity $key -EnterpriseVoiceEnabled $true -HostedVoiceMail $true -OnPremLineURI tel:$value
Write-Output '----------'
}
# Remove number from user
#Set-CsUser -Identity "John.Doe" -OnPremLineURI $null
#Get-CsOnlineUser -Filter {EnterpriseVoiceEnabled -eq $true} # M$ broke this boolean... :(
#Get-CsOnlineUser -Filter {EnterpriseVoiceEnabled -eq "True"} | Select alias,userprincipalname,samaccountname,interpret*,*voice*,*lineuri*,*dial*,*hosting*,*sip*,displayname
#Get-CsOnlineUser -Filter {EnterpriseVoiceEnabled -eq "True"} | Select alias,userprincipalname,samaccountname,OnPremLineURI,SipAddress | Format-Table
#Disconnect-MicrosoftTeams