tag:blogger.com,1999:blog-6109225494707488136.post8914343205332184275..comments2023-08-02T04:22:02.961-07:00Comments on My Scripts Repository: My Exchange 2010 Mailbox Move ScriptElkagorasahttp://www.blogger.com/profile/16868176919786509891noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-6109225494707488136.post-88051710548070314682015-08-27T06:01:27.856-07:002015-08-27T06:01:27.856-07:00Hello
Many thanks for the great script you provid...Hello<br /><br />Many thanks for the great script you provided. I've made some changes to the script because of the processing time. Even when I included the parameter -byPassDeptCheck it still checks the department of every users. So...<br /><br />I changed:<br /><br /> Write-Host "Checking to see if DEPT on destination matches destination of source mailboxes"<br /> $dbDeptgrp = $dbs | %{get-mailboxdatabase $_ | Get-Mailbox -resultsize 25 -warningaction silentlycontinue | get-user } | group department | sort count -Descending<br /> if ($dbDeptgrp -is [array]) {$dbDept = $dbDeptgrp[0].name} else {$dbDept = $dbDeptgrp.Name}<br /><br />To:<br /><br />if (!$byPassDept) {<br /> Write-Host "Checking to see if DEPT on destination matches destination of source mailboxes"<br /> $dbDeptgrp = $dbs | %{get-mailboxdatabase $_ | Get-Mailbox -resultsize 25 -warningaction silentlycontinue | get-user } | group department | sort count -Descending<br /> if ($dbDeptgrp -is [array]) {$dbDept = $dbDeptgrp[0].name} else {$dbDept = $dbDeptgrp.Name}<br /><br />}<br /><br />There where also some issues with the hard coded paths like PS:\Mv-Mbx2010.ps1. It didn't work for me. So I defined the following underneath the param function:<br /><br />$global:scriptpath = Split-Path $MyInvocation.MyCommand.Path<br /><br />and changed:<br /><br />PS:\Mv-Mbx2010.ps1 -batchname $BatchName -identity $missed -targetdatabase $dbs -dbselectionmethod $DBSelectionMethod -DontAutoSuspendWhenComplete -DontRetry<br /><br />To:<br /><br />& "$global:scriptpath\Mv-Mbx2010.ps1" -batchname $BatchName -identity $missed -targetdatabase $dbs -dbselectionmethod $DBSelectionMethod -DontAutoSuspendWhenComplete -DontRetry<br /><br />and changed:<br /><br />PS:\Mv-Mbx2010.ps1 -batchname $BatchName -identity $missed -targetdatabase $dbs -dbselectionmethod $DBSelectionMethod -dontretry<br /><br />To:<br /><br />& "$global:scriptpath\Mv-Mbx2010.ps1" -batchname $BatchName -identity $missed -targetdatabase $dbs -dbselectionmethod $DBSelectionMethod -dontretry<br /><br />Anonymousnoreply@blogger.com