2016-03-19 25 views
-1

異なるメールボックスクォータを持つ19人のユーザーを持つCSVファイルがあります。現在のメールボックスサイズに200MB以上を追加できます。メールボックスを設定しようとすると、現在のサイズが変更され、同じメールボックスクォータがすべて必要になります。私は現在のサイズに200MBを追加するだけです。Powershellメールボックスサイズを19MBから200MBに増やすExchange 2007

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

メールボックスクォータのスクリプトを

$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} 
+0

私はあなたが立ち往生するならあなたのスクリプトを手助けしますが、これはスクリプト作成サービスではありません。メールボックス情報を参照し、メールボックスサイズを返し、200MBを追加し、最後にそのメールボックスクォータを設定したいとします。エラーが発生した場合は、スクリプトを検索して投稿してください。 – user4317867

+0

ありがとうUser437867あなたの返事は:)私のスクリプトを書く人を探していないが、私はここのユーザーはpowershell \ excahngeの専門家であり、彼らはアイデアを共有していると思った 私は自分の仕事を達成する方法についてアイデアを探していた:)すべてのユーザーが同じメールボックスサイズを持つようにしたいのですが、現在のサイズにスペースを追加する方法を見つけようとしています。再度ご返信ありがとうございます – Yallabina

+0

データベースのデフォルトの割り当てを使用しない200Mbのすべての割り当て量を変更する予定ですか? – Matt

答えて

1

を見つけるためにあなただけの新しい値は、ループ内の各ユーザのために一意であるように、foreachのループ内の現在のクォータ値に200MBを追加する必要があります。どのようにあなたのcsvのように見えるかわからないので、私はサンプルcsvを作成しました。

これは

list.csv

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

サンプルのすべての未テストコードですので、私は、Exchange環境を持っていない:あなたのcsvファイルが含まれていない場合は

$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 
} 

現在のクォータ値を取得するには、Get-MailBoxを使用します。

$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 
} 
関連する問題