Powershell Increase mailbox size for 19 by 200MB Exchange 2007

1k Views Asked by At

I have CSV file with 19 users with different mailbox Quota, I want to be able to add 200mb more to their current mailbox size. if I tried set-mailbox it will change their current size and they all will have same mailbox quota which I dont want!! I only want to add 200MB to their current size.

$list = import-csv c:\list.csv 
foreach ($user in $list) {set-mailbox -identity $user.user -UseDatabaseQuotaDefaults $false -IssueWarningQuota 200MB -ProhibitSendQuota 250MB -ProhibitSendReceiveQuota 280MB}

To find mailbox quota script

$List = Import-Csv  C:\temp\Users_size.csv
foreach  ($user in $List){
  Get-Mailbox $user.user_id  |  fl name, *Quota    | Out-File -Append c:\size.csv 
  Get-MailboxStatistics $user.user_id | fl TotalItemSize  | Out-File -Append c:\size.csv}
1

There are 1 best solutions below

0
Frode F. On BEST ANSWER

You just need to add 200MB to the current quota-values inside the foreach-loop so the new value is unique for each user in the loop. I have no idea how your csv look like, so I created a sample-csv.

I don't have an Exchange-environment so this is all untested code

list.csv

User,IssueWarningQuota,ProhibitSendQuota,ProhibitSendReceiveQuota,SomeOtherColumns
User1,209715200,262144000,293601280,SomeOtherValue
User2,314572800,367001600,398458880,SomeOtherValue2

Sample:

$list = Import-Csv -Path c:\list.csv
foreach ($user in $list) {
    #Create variables with new quota-values for readability. Can be replaced with -IssueWarningQuoa ([int]$_.IssueWarningQuota + $AddQuota) -Prohi.... in the command itself.
    #Values from CSV are string by default, so we need to cast the value to int before adding (unless it will append to string).
    $IssueWarningQuota = [int]$_.IssueWarningQuota + 200MB
    $ProhibitSendQuota = [int]$_.ProhibitSendQuota + 200MB
    $ProhibitSendReceiveQuota = [int]$_.ProhibitSendReceiveQuota + 200MB

    Set-mailbox -identity $user.user -UseDatabaseQuotaDefaults $false -IssueWarningQuota $IssueWarningQuota -ProhibitSendQuota $ProhibitSendQuota -ProhibitSendReceiveQuota $ProhibitSendReceiveQuota
}

If your csv doesn't contain the current quota-values, you could use Get-MailBox to get them.

$list = Import-Csv -Path c:\list.csv
foreach ($user in $list) {
    $mb = Get-Mailbox $user.user

    $IssueWarningQuota = $mb.IssueWarningQuota + 200MB
    $ProhibitSendQuota = $mb.ProhibitSendQuota + 200MB
    $ProhibitSendReceiveQuota = $mb.ProhibitSendReceiveQuota + 200MB

    Set-mailbox -identity $user.user -UseDatabaseQuotaDefaults $false -IssueWarningQuota $IssueWarningQuota -ProhibitSendQuota $ProhibitSendQuota -ProhibitSendReceiveQuota $ProhibitSendReceiveQuota
}