Maintain control of your Microsoft 365 data
Post Reply
scarnes@apex.com
Service Provider
Posts: 9
Liked: 1 time
Joined: Jun 06, 2017 5:24 pm
Full Name: Stephen Carnes
Contact:

Powershell command to list users and mailbox count

Post by scarnes@apex.com »

Powershell command to list users and mailbox count for each organization. Is this possible? Is there another report that would give me this information?
Mike Resseler
Product Manager
Posts: 8191
Liked: 1322 times
Joined: Feb 08, 2013 3:08 pm
Full Name: Mike Resseler
Location: Belgium
Contact:

Re: Powershell command to list users and mailbox count

Post by Mike Resseler »

Hi Stephen,

First: Welcome to our forums!

I'm not sure what you exactly need but I think you can use this cmdlet from VBO to get what you need: https://helpcenter.veeam.com/docs/vbo36 ... tml?ver=15
scarnes@apex.com
Service Provider
Posts: 9
Liked: 1 time
Joined: Jun 06, 2017 5:24 pm
Full Name: Stephen Carnes
Contact:

Re: Powershell command to list users and mailbox count

Post by scarnes@apex.com »

Thank you for getting back to me! Im just trying to give a report to our finance department that lists each organization with the number of backed up mailboxes. However, when I try to run the powershell command i get the following error. Any ideas?

PS C:\Users\apex> Get-VBOOrganizationMailbox -Organization - Name "XXXX.onmicrosoft.com"

Get-VBOOrganizationMailbox : Cannot bind parameter 'Organization'. Cannot convert the "-" value of type
"System.String" to type "Veeam.Archiver.PowerShell.Model.VBOOrganization".
At line:1 char:42
+ Get-VBOOrganizationMailbox -Organization - Name "APEXTMI.onmicrosoft.com"
+ ~
+ CategoryInfo : InvalidArgument: (:) [Get-VBOOrganizationMailbox], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Veeam.Archiver.PowerShell.Cmdlets.Mailboxes.GetVBOOrganiz
ationMailbox
Polina
Veeam Software
Posts: 3191
Liked: 774 times
Joined: Oct 21, 2011 11:22 am
Full Name: Polina Vasileva
Contact:

Re: Powershell command to list users and mailbox count

Post by Polina »

Hi Stephen,

Please make sure you run VBO PowerShell Toolkit (the "burger" menu -> PowerShell)
nielsengelen
Product Manager
Posts: 5796
Liked: 1215 times
Joined: Jul 15, 2013 11:09 am
Full Name: Niels Engelen
Contact:

Re: Powershell command to list users and mailbox count

Post by nielsengelen »

Hi Stephen,

Remove the - and name. This is causing the error, as it only needs -organization to get all the mailboxes. If you use -name, you can filter by a specific mailbox.

Code: Select all

Get-VBOOrganizationMailbox -Organization "XXXX.onmicrosoft.com"
Personal blog: https://foonet.be
GitHub: https://github.com/nielsengelen
scarnes@apex.com
Service Provider
Posts: 9
Liked: 1 time
Joined: Jun 06, 2017 5:24 pm
Full Name: Stephen Carnes
Contact:

Re: Powershell command to list users and mailbox count

Post by scarnes@apex.com »

Still seems I get the same error with -Name removed. Even though this is the correct organization name? Whats the VBO toolbox you are referring too?


PS C:\Users\apex> Get-VBOOrganizationMailbox -Organization "APEXTMI.onmicrosoft.com"
Get-VBOOrganizationMailbox : Cannot bind parameter 'Organization'. Cannot convert the "APEXTMI.onmicrosoft.com" value
of type "System.String" to type "Veeam.Archiver.PowerShell.Model.VBOOrganization".
At line:1 char:42
+ Get-VBOOrganizationMailbox -Organization "APEXTMI.onmicrosoft.com"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-VBOOrganizationMailbox], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Veeam.Archiver.PowerShell.Cmdlets.Mailboxes.GetVBOOrganiz
ationMailbox

PS C:\Users\apex>
nielsengelen
Product Manager
Posts: 5796
Liked: 1215 times
Joined: Jul 15, 2013 11:09 am
Full Name: Niels Engelen
Contact:

Re: Powershell command to list users and mailbox count

Post by nielsengelen »

Hereby working code:

Code: Select all

$org = Get-VBOOrganization -Name "APEXTMI.onmicrosoft.com"
Get-VBOOrganizationMailbox -Organization $org
Personal blog: https://foonet.be
GitHub: https://github.com/nielsengelen
scarnes@apex.com
Service Provider
Posts: 9
Liked: 1 time
Joined: Jun 06, 2017 5:24 pm
Full Name: Stephen Carnes
Contact:

Re: Powershell command to list users and mailbox count

Post by scarnes@apex.com »

Thank you! That worked.

Now just one more question. Is there anyway I can use that to get a count of all backed up mailboxes per organization? Just a simple list?
Polina
Veeam Software
Posts: 3191
Liked: 774 times
Joined: Oct 21, 2011 11:22 am
Full Name: Polina Vasileva
Contact:

Re: Powershell command to list users and mailbox count

Post by Polina »

Out-of-the-box you can get a list of unprotected (not assigned to any of the backup jobs) mailboxes by adding the "NotInJob" parameter to the above code.

Then you can simply compare the two lists - all mailboxes vs not in the jobs mailboxes..
Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests