Maintain control of your Microsoft 365 data
Post Reply
biohazrd
Influencer
Posts: 14
Liked: 3 times
Joined: May 20, 2021 8:50 pm
Contact:

Frustrations with Powershell module

Post by biohazrd »

As part of our offboarding practice, we offload PST files from Office 365. We've begun to use Veeam for this and are attempting to automate this process using the Powershell module. However there are some annoying inconsistencies in the way that the various commandlets work.

For example:

Code: Select all

$User = Get-ADUser -Identity some.user
Connect-VBOServer
$Organization = Get-VBOOrganization -Name "Some Organization Name"
$Repository = Get-VBORepository -Name "Some Repository Name"
$User = Get-VBOOrganizationUser -Organization $Organization -UserName $User.SAMAccountName
$UserItems = New-VBOBackupItem -User $User -Mailbox -ArchiveMailbox -OneDrive
Add-VBOJob -Organization $Organization -Name $Username -Repository $Repository -SelectedItems $UserItems
This works exactly as expected, and it's very easy to use, clear and concise. Specficially, Get-VBOOrganizationUser accepts a Username which directly correlates to the SAMAccountName making this a breeze to use with Get-ADUser.

However, when I go to perform an export:

Code: Select all

$Session = Start-VBOExchangeItemRestoreSession -LatestState -Organization $Organization
$Database = Get-VEXDatabase -Session $Session
Get-VEXMailbox -Database $Database -Name $Name
I am now expected to use the "display name" of the mailbox. This makes no sense, I should be able to use Get-VEXMailbox using either a VBOOrganizationUser object or something like this:

Code: Select all

Get-VEXMailbox -Database $Database -Username $User.SAMAccountName
At the very least, there should be an Email parameter so that I can search with something like this:

Code: Select all

Get-VEXMailbox -Database $Database -Email $User.EmailAddress
Currently I can almost do this with the following:

Code: Select all

Get-VexMailbox -Database $Database | Where-Object { $_.Email -eq $User.EmailAddress }
However, since the filtering happens after the entire database worth of mailboxes have been retrieved from the server, it can be painfully slow for large organizations. Additionally, the Email property of the VEXMailbox object has a nasty tendency to be the "@onmicrosoft.com" email address (although this may be confined to my specific environment).

Finally, the existence of archive mailboxes causes further issues. Get-VEXMailbox using Name won't return the archive mailbox because the name of archive mailboxes are in the format

Code: Select all

In-Place Archive - Some User
This means that if I want to get both the standard and archive VEXMailbox for a user, I have to do something like this

Code: Select all

$User = Get-ADUser -Identity some.user
Get-VEXMailbox -Database $Database -Name @($User.Name, "In-Place Archive - $($User.Name)")
To be blunt, this sucks. Get-VEXMailbox would preferably return archive mailboxes by default, but I realize that would be a breaking change. A switch parameter like -IncludeArchive would be a welcome addition. Being able to get a VEXMailbox by email address should also solve this, as both the regular and archive mailbox have the same email address on the object.

Anyways, hopefully someone sees this who can pass it along. I love the product, but some of the functions leave a bit to be desired.
Mike Resseler
Product Manager
Posts: 8195
Liked: 1323 times
Joined: Feb 08, 2013 3:08 pm
Full Name: Mike Resseler
Location: Belgium
Contact:

Re: Frustrations with Powershell module

Post by Mike Resseler »

Hi @biohazrd

First: Thanks for your feedback. We do read this and take things into consideration. You are correct that this is something we can't fix very quickly I'm afraid. However, I can't test as I don't have access to an AAD authorized account at the moment, but can't you use the properties of Get-UserAD to get the mailbox directly?

Get-ADUser -Filter * -Properties EmailAddress,DisplayName, samaccountname| select EmailAddress, DisplayName
Post Reply

Who is online

Users browsing this forum: No registered users and 24 guests