Here’s a PowerShell tip I wanted to share for quite some time: making PowerGUI search for a user for you rather than displaying all users in the grid and then making you scroll down to find the account you need (for example in a helpdesk scenario when you need to unlock an account or reset password for someone calling you):
Once you type something about the user (name, partial name as in the screenshot above, email address, office location, SID, GUID, login name) you get the account (or list of accounts) which the search would return.
Here’s how you add a node like that:
- In PowerGUI, right-click the place in the left-hand tree where you want to place the functionality,
- On the shortcut menu, select New / Script Node.
- Supply the name and code for the node:
Here’s the code which I use:
# Locate a user account $user = Read-Host "Who do you want to find today?" Get-QADUser $user
Now you (or your helpdesk) will be able to find the objects they need much faster!