Příspěvky

Zobrazují se příspěvky z duben, 2017

Disable Lync accounts for users disabled in AD

Obrázek
Hi all, few days ago I had to do some clean up tasks at one of our customer. Goal was to disable Lync accounts for users, that do not work for company anymore. It seems like a powershell mission. To get list of disabled AD accounts that still have enabled Lync you can use following line: Get -CsAdUser   -ResultSize   Unlimited |  Where-Object   {$_.UserAccountControl  -match "AccountDisabled"   -and   $_.Enabled  -eq   $true } |  Format-Table   Name,Enabled,SipAddress  -auto Then you can easily remove Lync account by using following line: Get -CsAdUser   -ResultSize   Unlimited |  Where-Object   {$_.UserAccountControl  -match "AccountDisabled"   -and   $_.Enabled} | Disable -CsUser