Remove all Delegate from Skype SQL Database „RTCLocal“<\/p>\n
We know that we have sometimes Problem with Delegates, we can\u00b4t read \/ Change \/ remove with sefautil.exe.<\/p>\n
I create a Script for this issue, this is very helpful<\/p>\n
If you have more delegate under „Manage Calls from:“ and no other Chance to remove it, you can use this small script.<\/p>\n
<\/p>\n
Example: Get-SFBDelegate -DelegatorSip test1@contoso.com -DelegateSIP Test2@contoso.com<\/p>\n
<\/p>\n
<\/p>\n
$SFBPools = Get-CsService | sort identity |select identity $menu = @{} ################################################################### $array =@()<\/p>\n foreach ($server in $Servers){<\/p>\n $DelegateQuery = „Select * From rtc.dbo.Resource Where UserAtHost= $resourceID = $DelegatorResult.ResourceId foreach ($Delegation in $DelegationResult){ if ($DelegateResult.ResourceId -notmatch $search){$toRemove = „yes“} else {$toRemove = „no“}<\/p>\n $Subscribs = New-Object psobject -Property @{DelegatorId = $Delegation.DelegatorId; ($Global:array = $array)| sort toRemove | ft -a Delegator*, Delegate*, Front*, to*<\/p>\n if (!([string]::IsNullOrEmpty($Global:array))){<\/p>\n $n = „n“ if ($n -eq ‚y‘){ $server = $arr.FrontendServer+“\\rtclocal“ $SubscriberId | ft -a }# Remove Delegator in SQL DATABASE end<\/p>\n","protected":false},"excerpt":{"rendered":" Remove all Delegate from Skype SQL Database „RTCLocal“ We know that we have sometimes Problem with Delegates, we can\u00b4t read \/ Change \/ remove with sefautil.exe. I create a Script for this issue, this is very helpful If you have more delegate under „Manage Calls from:“ and no other Chance to remove it, you can […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[2],"tags":[50,47,48,51,34,30,49],"yoast_head":"\n
\nfunction Get-SfBDelegate {
\nParam([Parameter(Mandatory=$True,Position=0)][string]$delegateSIP,
\n[Parameter(Mandatory=$True,Position=1)][string]$delegatorSIP)<\/code><\/p>\n
\n$table =@()
\nforeach ($SFBPool in $SFBPools.identity)
\n{
\n$split = $SFBPool.Split(„:“)
\n$table += @{‚Function‘ = $split[0];’FQDN’=$split[1]}
\n}
\n$out = $table.ForEach({[PSCustomObject]$}) | ?{$<\/em>.Function -match „registrar“} | Group-Object -Property Function<\/p>\n
\n$Fqdn = ($out.group | ?{$_.FQDN -match „pool“} | select fqdn -Unique).FQDN
\nif ($fqdn.Count -gt „1“){
\nfor ($i=1;$i -le $FQDN.count; $i++) {
\nWrite-Host “ $i. $($FQDN[$i-1])“
\n$menu.Add($i,($FQDN[$i]))
\n}
\n}
\nelse{
\nfor ($i=1;$i -le $FQDN.count; $i++) {
\nWrite-Host “ $i. $($FQDN)“
\n$menu.Add($i,($FQDN[$i]))
\n}
\n}
\n[int]$ans = Read-Host ‚Enter selection‘
\n$selection = $menu.Item($ans)
\n$servers = (Get-CsComputer -Pool $selection).identity<\/p>\n
\n#$Servers = (Get-CsComputer | Where-Object -Property Pool -Match $pool | Select-Object identity).identity<\/p>\n'$delegateSIP<\/code>‚“
\n$DelegateResult= (Invoke-Sqlcmd -ServerInstance $Server\\rtclocal -Query $DelegateQuery)
\n$DelegatorQuery= „Select * From rtc.dbo.Resource Where UserAtHost='$delegatorSIP<\/code>‚“
\n$DelegatorResult= (Invoke-Sqlcmd -ServerInstance $Server\\rtclocal -Query $DelegatorQuery)<\/p>\n
\n$DelegationQuery = „select * From [rtc].[dbo].[Delegate] Where DelegatorId = '$resourceID<\/code>‚“
\n$DelegationResult =(Invoke-Sqlcmd -ServerInstance $Server\\rtclocal -Query $DelegationQuery)<\/p>\n
\n$search = $Delegation.DelegateId
\n$SQLscript = „select * From rtc.dbo.Resource where ResourceId = '$search<\/code>‚“
\n$return= (Invoke-Sqlcmd -ServerInstance $Server\\rtclocal -Query $SQLscript)<\/p>\n
\nDelegatorSIP =$DelegatorResult.UserAtHost;
\nDelegateId = $Delegation.DelegateId;
\nDelegateSIP =$return.UserAtHost;
\nFrontendServer = $server;
\ntoRemove = $toRemove}
\n$array += $Subscribs
\n}
\n}<\/p>\n
\n$n = Read-Host -Prompt „Do you like to remove all with property toRemove = yes? Press y = yes, n = no“<\/p>\n
\nforeach ($arr in $array){
\nif ($arr -match „yes“) {
\n$removeDelegator = $arr.DelegatorId
\n$removeDelegate = $arr.DelegateId
\n$DeleteQuery =“Delete From [rtc].[dbo].[PromptedSubscriber] Where PublisherId = '$removeDelegator<\/code>‚ AND SubscriberId =
'$removeDelegate<\/code>‚
\nDelete From [rtc].[dbo].[Delegate] Where DelegatorId = '$removeDelegator<\/code>‚AND DelegateId =
'$removeDelegate<\/code>‚“<\/p>\n
\nInvoke-Sqlcmd -ServerInstance $server -Query $DeleteQuery -ErrorAction SilentlyContinue
\nWrite-Output „DELETED !!“
\n$arr | ft -a
\n}<\/p>\n
\n}
\n}
\n}
\nelse {Write-Host „we dont found Entrys for the delegator: $delegatorSIP and delegate: $delegateSIP „}<\/p>\n