Enable AD Users with Out-GridView

by May 2, 2017

Sometimes it requires just a couple of lines of code in PowerShell to produce highly useful helpdesk tools. Here is one that displays all currently disabled AD users. You can select one (or many by holding CTRL), and once you click OK, these users will be enabled:

#requires -Version 3.0 -Modules ActiveDirectory
Search-ADAccount -AccountDisabled |
  Out-GridView -Title 'Who should be enabled?' -OutputMode Multiple |
  # remove -WhatIf to actually enable accounts
  Enable-ADAccount -WhatIf

Twitter This Tip! ReTweet this Tip!