Disable Lync accounts for users disabled in AD
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:
Then you can easily remove Lync account by using following line:
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 -autoThen you can easily remove Lync account by using following line:
Get-CsAdUser -ResultSize Unlimited | Where-Object {$_.UserAccountControl -match"AccountDisabled" -and $_.Enabled} | Disable-CsUser
Komentáře
Okomentovat