As you definitely know disabling user in Active Directory won’t disable it in Skype for Business. That’s because Skype for Business uses it’s own AD attributes. So such users will still be visible in Skype for Business Control Panel and in licenses count.
Here is a Powershell command that will find Active Directory disabled accounts with Skype for Business enabled:
1 |
Get-CsAdUser -ResultSize Unlimited | Where-Object {$_.UserAccountControl -match "AccountDisabled" -and $_.Enabled -eq $true} | Format-Table Name,Enabled,SipAddress -auto |
You can also count such users with:
1 |
Get-CsAdUser -ResultSize Unlimited | Where-Object {$_.UserAccountControl -match "AccountDisabled" -and $_.Enabled} | Measure-Object |
Finally, you can disable Skype for Business users that have their AD account disabled with:
1 |
Get-CsAdUser -ResultSize Unlimited | Where-Object {$_.UserAccountControl -match "AccountDisabled" -and $_.Enabled} | Disable-CsUser |