Link to home
Start Free TrialLog in
Avatar of bpl5000
bpl5000

asked on

Setting "use mailbox database defaults" with PowerShell

In the EMC, there is a setting called "use mailbox database defaults".  I need to turn this on, but I have over 800 mail accounts so I need to do it with PowerShell.  How can I do this with PowerShell?  Maybe something similar to "set-mailbox -UseDatabaseQuoteDefault $true"?

Please no links to other threads, just the command to accomplish this.
Thanks,
BPL
ASKER CERTIFIED SOLUTION
Avatar of SubSun
SubSun
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can also get all of the users that require this change first, then run the command to enable the setting...

Add-PSSnapin Microsoft.Exchange.Management.Powershell.Admin
Import-Module activedirectory
get-mailbox -ResultSize "unlimited" | 
Where-Object {$_.UseDatabaseQuotaDefaults -eq $false} | 
select samaccountname | Out-File "c:\StorageSettings.csv"
$UsersList = Import-csv "c:\storagesettings.csv"
$UsersList = foreach ($Account in $UsersList) {
$Account.samaccountname
Set-Mailbox -Identity $Account.samaccountname -UseDatabaseQuotaDefaults:$true
}

Open in new window


The code above will also display all of the users that were in fact modified.

Hope this helps!
Avatar of bpl5000
bpl5000

ASKER

I ran this command and it did set it to use the defaults on the mailboxes, but when I check quotas thru PowerShell, ProhibitSendQuota (and others) did not change.  I can see the settings in the EMC... they are greyed out, but still the old settings.  I tried running this...

Get-mailbox | set-mailbox -UseDatabaseQuotaDefaults:$True -ProhibitSendQuote "unlimited" -ProhibitSendReceiveQuots "unlimited" -IssueWarningQuota "unlimited"

and

Get-mailbox | set-mailbox -UseDatabaseQuotaDefaults:$True -ProhibitSendQuote 6000 -ProhibitSendReceiveQuots 6000 -IssueWarningQuota 5000

But cannot get anything to work.  Any ideas?
they are greyed out, but still the old settings.
It means the configuration is set.. When you set UseDatabaseQuotaDefaults to $True then the mailbox will look for database setting for quota..
It should show like this..
User generated image
Avatar of bpl5000

ASKER

Yes, but instead it looks like this...
quota.jpg
That's fine.. Since UseDatabaseQuotaDefaults is set to $True mailbox Quota settings will be ignored..
Avatar of bpl5000

ASKER

Yes, that's what I assumed, but when I look at it in PowerShell, it doesn't seem to be the case.
User generated image
It is just showing the values assigned to that attribute, Get-Mailbox command is not intelligent enough to verify the UseDatabaseQuotaDefaults values and display the results .. As I said if the UseDatabaseQuotaDefaults is set to $True mailbox Quota settings will be ignored..
Avatar of bpl5000

ASKER

Ok, awesome!  You are my hero!