sorry for the amature style script but this is what I got so far:
Increase-MailboxQuota.ps1
Script for incrementing mailbox quotas
Amount to increase Quotas in megabytes
if ((get-pssnapin |% {$_.name}) -notcontains “Microsoft.Exchange.Management.PowerShell.E2013”){
. ‘C:\Program Files\Microsoft\Exchange Server\V15\bin\RemoteExchange.ps1’
Connect-ExchangeServer -auto
}
$QuotaWarning = 10
$QuotaSend = 30
$QuotaSendRecieve = 50
Get the mailbox
$Mailboxes = Get-Mailbox -ErrorAction Silentlycontinue
foreach ($mailbox in $Mailboxes)
{
Getting the current mailbox information,size and quota
$DisplayName = $Mailbox.DisplayName
$Database = $Mailbox.Database
$UsingDBQuotas = $Mailbox.UseDatabaseQuotaDefaults
$MailboxSize = (Get-MailboxStatistics -Identity $Mailbox.Name).TotalItemSize.value.ToMB()
$CurrentWarningQuota = $Mailbox.IssueWarningQuota.value.ToMB()
$CurrentSendQuota = $Mailbox.ProhibitSendQuota.value.ToMB()
$CurrentSendRecieveQuota = $Mailbox.Prohibitsendreceivequota.value.ToMB()
Calculate the new quotas
$NewWarningQuota = $MailboxSize + $QuotaWarning
$NewSendQuota = $MailboxSize + $QuotaSend
$NewSendRecieveQuota = $MailboxSize + $QuotaSendRecieve
Set the new values on the mailbox
$NewWarningQuotaset = [STRING]$NewWarningQuota + “MB”
$NewSendQuotaset = [STRING]$NewSendQuota + “MB”
$NewSendRecieveQuotaset = [STRING]$NewSendRecieveQuota + “MB”
Set-Mailbox -Identity $Mailbox -UseDatabaseQuotaDefaults $False -ProhibitSendQuota $NewSendQuotaset -IssueWarningQuota $NewWarningQuotaset -Prohibitsendreceivequota $NewSendRecieveQuotaset
output some new and old info
}
seems to do what it was intended although when running it from ise(don't think it matters)
I get a lot of these errors:
PS C:\Windows\system32> C:\Users\administrator.TEST\Desktop\quota.ps1
Welcome to the Exchange Management Shell!
Full list of cmdlets: Get-Command
Only Exchange cmdlets: Get-ExCommand
Cmdlets that match a specific string: Help <string>
Get general help: Help
Get help for a cmdlet: Help <cmdlet name> or <cmdlet name> -?
Show quick reference guide: QuickRef
Exchange team blog: Get-ExBlog
Show full output for a command: <command> | Format-List
Tip of the day #19:
If you want to test all IP Block List providers, you just have to pipe the Get-IpBlockListProvider cmdlet to the Test-IpBlockListProvider cmdlet:
Get-IpBlockListProvider | Test-IpBlockListProvider -IpAddress 192.168.0.1
VERBOSE: Connecting to EX1.Test.corp.
VERBOSE: Connected to EX1.Test.corp.
You cannot call a method on a null-valued expression.
At C:\Users\administrator.TEST\Desktop\quota.ps1:30 char:1
You cannot call a method on a null-valued expression.
At C:\Users\administrator.TEST\Desktop\quota.ps1:31 char:1
You cannot call a method on a null-valued expression.
At C:\Users\administrator.TEST\Desktop\quota.ps1:32 char:1
WARNING: The user hasn’t logged on to mailbox ‘DiscoverySearchMailbox {D919BA05-46A6-415f-80AD-7E09334BB852}’ (‘f8bff58a-ef06-498d-8462-49df5e38393c’), so the
re is no data to return. After the user logs on, this warning will no longer appear.
You cannot call a method on a null-valued expression.
At C:\Users\administrator.TEST\Desktop\quota.ps1:29 char:1
You cannot call a method on a null-valued expression.
At C:\Users\administrator.TEST\Desktop\quota.ps1:30 char:1
You cannot call a method on a null-valued expression.
At C:\Users\administrator.TEST\Desktop\quota.ps1:30 char:1
You cannot call a method on a null-valued expression.
At C:\Users\administrator.TEST\Desktop\quota.ps1:31 char:1
You cannot call a method on a null-valued expression.
At C:\Users\administrator.TEST\Desktop\quota.ps1:32 char:1
You cannot call a method on a null-valued expression.
At C:\Users\administrator.TEST\Desktop\quota.ps1:30 char:1
You cannot call a method on a null-valued expression.
At C:\Users\administrator.TEST\Desktop\quota.ps1:31 char:1
You cannot call a method on a null-valued expression.
At C:\Users\administrator.TEST\Desktop\quota.ps1:32 char:1
I would also like to add some output to txt or csv(didn’t figure that one yet)
to output what the old value was and what the new value is per mailbox.
any ideas?