无法在 PowerShell 中从 CsOnlineUser 中删除 OnlineVoiceRoutingPolicy

无法在 PowerShell 中从 CsOnlineUser 中删除 OnlineVoiceRoutingPolicy

在 PowerShell 中将 VoiceRoutingPolicy 添加到 CsOnlineUser 后,我无法再次将其删除,这使我无法删除 VoiceRoutingPolicy。

根据微软的文档,我需要使用Grant-CsVoiceRoutingPolicy并简单地$Null向用户授予一项策略。我尝试了以下操作,但不幸的是没有成功:

PS C:\Users\jkj> Get-CsOnlineUser -Identity [email protected] | Select-Object OnlineVoiceRoutingPolicy, UserPrincipalName
OnlineVoiceRoutingPolicy UserPrincipalName
------------------------ -----------------
DK1002                   [email protected]


PS C:\Users\jkj> Grant-CsOnlineVoiceRoutingPolicy -Identity "[email protected]" -PolicyName $Null -WarningVariable Warn -ErrorVariable ErrorVar -Verbose
PS C:\Users\jkj> Get-CsOnlineUser -Identity [email protected] | Select-Object OnlineVoiceRoutingPolicy, UserPrincipalName
OnlineVoiceRoutingPolicy UserPrincipalName
------------------------ -----------------
DK1002                   [email protected]


PS C:\Users\jkj> $Warn
PS C:\Users\jkj> $ErrorVar
PS C:\Users\jkj>

我还尝试通过强制删除 VoiceRoutingPolicy 来实现这一点。这是针对不同的用户和策略进​​行的。

我可以删除 VoiceRoutingPolicy,但用户仍然分配有策略“100000001”,并在获取用户时打印警告:

PS C:\Users\jkj> Remove-CsOnlineVoiceRoutingPolicy -Identity DK -Force
PS C:\Users\jkj> Get-CsOnlineUser -Identity [email protected] | Select-Object OnlineVoiceRoutingPolicy, UserPrincipalName
WARNING: "OnlineVoiceRoutingPolicy" with identity "1000000001" assigned to "sip:[email protected]" has been removed from configuration store.

OnlineVoiceRoutingPolicy UserPrincipalName
------------------------ -----------------
1000000001               [email protected]


PS C:\Users\jkj>

所以我还没有成功地从用户那里删除 VoiceRoutingPolicy。

有人成功从 CsOnlineUser 中删除 VoiceRoutingPolicy 吗?

答案1

我与一位使用 Microsoft Teams 和 Skype for Business Online 的联系人进行了交谈。他告诉我,通常在运行命令后不久就会生效,但我可能遇到了复制问题。如果是这样的话,根据他的估计,最多可能需要 4 个小时才能完成。

我尝试将它保留一夜,现在所有用户的 VoiceRoutingPolicies 都已成功删除:

PS C:\Git\teams-powershell> Get-CsOnlineUser | Select-Object OnlineVoiceRoutingPolicy, UserPrincipalName

OnlineVoiceRoutingPolicy UserPrincipalName
------------------------ -----------------
                         [email protected]
                         [email protected]
                         [email protected]
                         [email protected]
                         [email protected]
                         [email protected]
                         [email protected]


PS C:\Git\teams-powershell>

对于我的脚本,我没有时间等待长达 4 个小时,因此我的解决方法是强制删除该策略,然后将所有用户设置为该策略$Null应在一段时间后生效。

因此,举个例子如下:

Remove-CsOnlineVoiceRoutingPolicy -Identity DK -Force
Grant-CsOnlineVoiceRoutingPolicy -Identity "[email protected]" -PolicyName $Null
Grant-CsOnlineVoiceRoutingPolicy -Identity "[email protected]" -PolicyName $Null
Grant-CsOnlineVoiceRoutingPolicy -Identity "[email protected]" -PolicyName $Null
Grant-CsOnlineVoiceRoutingPolicy -Identity "[email protected]" -PolicyName $Null

相关内容