anonit

Disables a list of AD user accounts based on Displayname

Jul 30th, 2019
722
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # DisableADUsers.ps1
  2. # Disables a list of AD user accounts based on Displayname
  3.  
  4. $Users = get-content "accounttodisable.txt"
  5. Get-ADUser -Filter '*' -Properties DisplayName,Office | where-object { $Users -contains $_.Displayname } | set-aduser -Enabled $FALSE
Add Comment
Please, Sign In to add comment