MoveMailbox.ps1$UserFile = "users.txt"
$MyData = Import-Csv $UserFile -Delimiter ;
ForEach ($item in $MyData){
$UserIdentity = $($item.UserIdentity)
$TargetDatabase = $($item.TargetDatabase)
$BadTolerance = $($item.BadTolerance)
if ($UserIdentity -match "^*[a-z0-1]@domain.cz$") {
New-MoveRequest -Identity $UserIdentity -TargetDatabase $TargetDatabase -BadItemLimit $BadTolerance
} else {
Write-Host "Bad user login $UserIdentity!" -foregroundcolor "red"
}
}
users.txtUserIdentity;TargetDatabase;BadTolerance
user@domain.cz;exch10_db_1;10
Command to schedule:powershell -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; C:\Scripts\MoveMailbox.ps1"