Office 365 Search for Alias PowerShell

I recently came across a situation where spam was being delivered to an email address of a former employee. I was certain that the previous employee did not have a mailbox, but I wasn’t convinced that the address was not being used as an alias on another account. Since I didn’t remember where I pointed the alias, I had to do some searching.

I connected to Office 365 Exchange via PowerShell and ran the following commands:

$LiveCred = Get-Credentials
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $LiveCred -Authentication Basic -AllowRedirection
Import-PSSession $Session
Get-Mailbox -Identity * | Where-Object {$_.EmailAddresses -like 'smtp:ml*'} | Format-List Identity

The Get-Mailbox searched through all of the mailboxes with the wildcard (*). After that, the Where-Object looked for similar results in the EmailAddresses attribute in all the mailboxes. Then I displayed the Identity of the user that has the alias in their account.

Pretty easy and straightforward, but it was a nice way to search through a lot of email addresses without a lot of work. If you want to see the actual email addresses, you can add EmailAddresses at the end of the Format-List.

Get-Mailbox -Identity * | Where-Object {$_.EmailAddresses -like 'smtp:ml*'} | Format-List Identity, EmailAddresses

Backup Exec 2014 Failing After Migrating VMware Virtual Machine to vApp

The Problem

I recently hit a snag with Backup Exec 2014 V-Ray and vApps. What I noticed is once a virtual machine (I’ve only tested with Linux) is moved into a vApp, Backup Exec will not backup the virtual machine. 

I was receiving an email that gave this information:

(Server: “BackupExecServer“) (Job: “XXX-Incremental”) XXX-Incremental — The job failed with the following error: Cannot get the configuration details of a VMware virtual machine. After investigating the Backup Exec console, I found this error.

1Following the V-79-57344-38211 link gives you some awesome information, which can be found here, and actually contains the solution. But I wanted to know why it really happened. 


“The above error would occur if one or more virtual machines have been moved to a different ESX host and the previous non existent entries remain on the view selection list details.”


So there you have it, the solution. But, it didn’t seem quite right to me; I NEVER changed hosts, just moved the VM into a vApp.

The Test

In order to test this, I downloaded DSL and installed it in my virtual machine cluster. I let DRS choose where it wanted to put it, but did not put the VM in a vApp, as you can see below. 



I then created a backup set in Backup Exec 2014 and pointed to the virtual machine. After all that was set up, I ran the full and incremental backups, which were successful.  



Once I got everything working, it was time to test my solution in breaking the backup. First, I created the vApp named test.



Once the vApp was created, I moved the DSL VM into vApp. 

6Then I ran the Incremental backup again, which failed. 



If you’re like me, you just started asking why it failed. According to the BE documentation, it would have had to move hosts, in this case it didn’t. Right clicking on the job in the Backup Exec console, and selecting “Edit” will help us find out.


This will take us into the “Backup Definition Properties” page. Selecting “Edit” under the vCenter server will give us more information.

9Once there, select “Selection Details” tab. This will show the selection details. Then select “Modify”


This will show the “Include/Exclude” window, and allow you to see why, and change the setting.

If you look under “Resource name” you will see the path to the VM. Which is wrong since you moved in into a vApp. 


In order to fix the error, you have to insert a new selection. You need to cancel out of the previous “Modify” window and select “Insert” then “Insert Selection” from the drop down. This will take you to a similar window, from there, drill down and select the VM inside of the vApp. 


Select OK. You will then notice that there are two selections in the “Backup Selections” window. 


Select the top one, which is the oldest, and hit “Delete” 

 To verify the correct configuration, select “Modify” on the new item, you should see the “Resource name” updated to include the vApp.


Select OK until the configuration is saved. 

At that point I ran the backup again to verify that it worked. If you’re doing incremental backups, it will work with exceptions. In my case, the exception indicated that I needed to run a full backup first, then run an incremental backup again. I did in order to get a successful backup.




This process failed once you moved it into the vApp because you actually changed the path (Resource name) that Backup Exec uses to find the VM. If you don’t update the path, it’s looking for a machine that actually doesn’t exist.