Find-EmailAddress is a PowerShell script that retrieves Active Directory objects by searching for a specified email address or alias. The script then outputs the object's username, display name, email address, and the Organizational Unit (OU) location.
The script requires PowerShell 3.0 or later and the Active Directory module to be installed on your system. To check the PowerShell version on your system, run the following command:
$PSVersionTable.PSVersion
If you have an earlier version of PowerShell, consider upgrading to a newer version for better compatibility and security. You can download the latest version of PowerShell from the official GitHub repository.
To install the Active Directory module, you can follow the instructions in this Microsoft guide.
- Download the
Find-EmailAddress.ps1
script. - Save it to a convenient location on your computer or server.
Open a PowerShell terminal and navigate to the directory where you saved the script. Run the script with the desired email address or alias as an argument:
.\Find-EmailAddress.ps1 -EmailAddress "[email protected]"
The script will output a table with the columns UserName
, DisplayName
, EmailAddress
, and OU
.
For help and more information about the script, run:
Get-Help .\Find-EmailAddress.ps1 -Detailed
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Commit your changes.
- Push your changes to your fork.
- Open a pull request.