Last active
          July 12, 2018 18:15 
        
      - 
      
- 
        Save tomarbuthnot/38c992ad9df0c9d4a95a to your computer and use it in GitHub Desktop. 
    Find Disabled Active Directory Accounts Who are Still Lync Enabled
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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