Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tomarbuthnot/38c992ad9df0c9d4a95a to your computer and use it in GitHub Desktop.
Save tomarbuthnot/38c992ad9df0c9d4a95a to your computer and use it in GitHub Desktop.
Find Disabled Active Directory Accounts Who are Still Lync Enabled
Find Disabled Active Directory Accounts Who are Still Lync Enabled
# Credit: http://www.ehloworld.com/265
Get-CsAdUser| Where-Object {$_.UserAccountControl -match "AccountDisabled" -and $_.Enabled -eq $true} | Format-Table Name,Enabled,SipAddress -auto
And, if you want, can disable them in one line using
Get-CsAdUser | Where-Object {$_.UserAccountControl -match "AccountDisabled" -and $_.Enabled} | Disable-CsUser -Verbose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment