Compare commits

...

3 Commits

3 changed files with 47 additions and 4 deletions

38
Docs/alias-toolkit.md Normal file
View File

@ -0,0 +1,38 @@
# Alias Toolkit
## How to use Alias Toolkit
1. Download the script or clone this repository
2. Make sure the execution policy is set properly (Or run Set-ExecutionPolicy Bypass -Scope Process)
3. Run the script.
4. Follow the on-screen prompts.
> _If target is Exchange Server, run script from the Exchange Management Shell._
>
>_If target is Exchange Online, run from a PS session that has already connected to Exchange Online Management Shell._
## Alias Toolkit Options
### 1. List contents of a .csv
Use this option to verify that your .csv file containing email addresses is formatted correctly. The output should look like:
> _Display Name_
>
> _Email Address 1_
>
> _Email Address 2_
>
> _Email Address 3_
If the email addresses are on a single line, your formatting isn't correct and the import will import all your addresses as a single email address.
### 2. Apply the contents of a .csv to the currently logged in Exchange session
Use this option to apply the email addresses when you've verified that the .csv is formatted correctly.
> ***This will apply the email addresses based on Display Name, so make sure that if display names were changed between environments, the .csv has been edited to reflect the changes.***
### 3. Create a .csv based on a search term
This option will create a .csv with the columns Displayname and EmailAddresses based on the search term given.
This uses `Get-Mailbox | Where-Object $_.EmailAddresses -like "$SearchTerm"`, so it will support wildcards.
>***This won't give you a .csv you can apply by default, this is by design. `You need to replace the spaces with ; in the EmailAddresses column.` This was implemented to ensure double-checking no unwanted addresses are included into the import.***
### 4. Use the legacy search script and output the alias list to console.
This does the same as the above option, but outputs the results to console with some nice-ish formatting. This is an adaptation of search-email-addresses.

View File

@ -1,3 +1,8 @@
# Exchange-Scripts
Various scripts used for management tasks (and migrations) on Exchange server
This repo contains various scripts used for management tasks (and migrations) on Exchange Server (and Exchange Online). You can click on the script name to see documentation for it.
# Scripts
- [**Alias Toolkit**](Docs/alias-toolkit.md) - Easy to use, menu-based script for searching for, exporting and importing aliases from/to Exchange (Online).
- **List alias .csv contents** - _This has been integrated into Alias Toolkit._
- **Search Email Addresses** - _This has been integrated into Alias Toolkit._

View File

@ -11,7 +11,7 @@
Write-Host "2: Press" -NoNewline
Write-Host -Foregroundcolor Cyan " '2' " -NoNewline
Write-Host "to apply the contents of a .csv to the currently logged in Exchange Online session."
Write-Host "to apply the contents of a .csv to the currently logged in Exchange session."
Write-Host "3: Press" -NoNewline
Write-Host -ForegroundColor Cyan " '3' " -NoNewline
@ -59,9 +59,9 @@ do
Set-Mailbox -Identity $Alias.Displayname -EmailAddresses $Alias.EmailAddresses.Split(";")
}
#Get the mailboxes from Exchange Online and print the email addresses to confirm the changes.
#Get the mailboxes from Exchange and print the email addresses to confirm the changes.
Foreach ($Alias in $Alias_list) {
$addresses = (Get-ExoMailbox -Identity $Alias.Displayname).EmailAddresses
$addresses = (Get-Mailbox -Identity $Alias.Displayname).EmailAddresses
if ($addresses -eq $Alias.EmailAddresses) {
Write-Host "$($Alias.Displayname)" -NoNewline
Write-Host -ForegroundColor Green " Success!"