Sometime ago I watched Trevor Sullivan video on Channel 9 about TabExpansionPlusPlus and I was blow away. I though WOW how much this can make my job easier.
TabExpansionPlusPlus is PowerShell module created by Jason Shirk which can be downloaded from GitHub https://github.com/lzybkr/TabExpansionPlusPlus or using PowerShell Find-Module command. This module after installation allow me create custom tab completion object for command which do not offer tab complation for all parameters.
I decide to use TabExpansion module to create tab completion for Unlock-ADAccount command. Running Unlock-ADAccount we need to specify Identity of user account we want to unlock, which make necessary to run Search-ADAccount -LockedOut command to find out which account is locked at this moment.
My custom Tab completion command runs Search-ADAccount -LockedOut inside ScriptBlock and provide this information to command Unlock-ADAccount while specifying -Identity parameter. We get Tab Completion list of users account lock-out at this point of time. Simply selecting correct user and pressing enter will unlock that user.