How do I export a list of OWA enabled users with their mailbox size in PowerShell?

0
10
Asked By TechWizard99 On

I'm trying to export a CSV file that lists all users with OWA enabled, showing their usernames and mailbox sizes. I managed to run the Get-CASMailbox command, but I'm having trouble retrieving the mailbox size. I'm encountering an error that says: 'Cannot bind argument to parameter 'Identity' because it is null.' I would appreciate any help on what I might be doing wrong!

3 Answers

Answered By DebugNinja On

Don't forget to debug your script! It’s always good practice to step through your code line by line. Start by gathering all mailboxes with `Get-CASMailbox` and check if anything comes back before you try further operations. Validate each mailbox item as you go, then pull the mailbox statistics into your report object.

CodeFixer42 -

Absolutely! Taking that step-by-step approach can save you a lot of time and help you pinpoint where things might be going wrong. Plus, it'll help you understand your script better!

Answered By PowerShellGuru77 On

The issue here is that `Get-CASMailbox` doesn’t have the `UserPrincipalName` property. Instead, you'll want to use `PrimarySMTPAddress` or `SamAccountName` to access the usernames. This change should resolve your null error when trying to assign the user variable.

Answered By ScriptMaster21 On

First, try running just `Get-CASMailbox -ResultSize Unlimited | Where-Object { $_.OWAEnabled -eq $true }` by itself. This will help you see if it’s returning any results or just getting null values. That could point to what’s going wrong in your script.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.