##Importing the file
####Ensure to remove "Target Database" Column with "TargetDatabase" with no space in input csv file
$all = Import-Csv .\Mailboxmove.csv
##Defining the batch name
$OurBatchName = "Mailbox Move - 5 July"
## Creating the move requests for users
foreach($a in $all)
{
##Check and clear if there is any existing move request for the user
Get-MoveRequest $a.PrimarySmtpAddress | Remove-MoveRequest -Confirm:$False
##Wait for 10 seconds before creating the move request
Start-Sleep 10
##Create the move request
New-MoveRequest $a.PrimarySmtpAddress -PrimaryOnly -TargetDatabase $a.TargetDatabase -BatchName $OurBatchName
}
####Ensure to remove "Target Database" Column with "TargetDatabase" with no space in input csv file
$all = Import-Csv .\Mailboxmove.csv
##Defining the batch name
$OurBatchName = "Mailbox Move - 5 July"
## Creating the move requests for users
foreach($a in $all)
{
##Check and clear if there is any existing move request for the user
Get-MoveRequest $a.PrimarySmtpAddress | Remove-MoveRequest -Confirm:$False
##Wait for 10 seconds before creating the move request
Start-Sleep 10
##Create the move request
New-MoveRequest $a.PrimarySmtpAddress -PrimaryOnly -TargetDatabase $a.TargetDatabase -BatchName $OurBatchName
}
No comments:
Post a Comment