databasename
}
elseif ($g2k -contains $firstchar)
{
$targetDB = $mailboxdatabases[1].databasename
}
elseif ($l2p -contains $firstchar)
{
$targetDB = $mailboxdatabases[2].databasename
}
elseif ($q2t -contains $firstchar)
{
$targetDB = $mailboxdatabases[3].databasename
}
elseif ($u2z -contains $firstchar)
{
$targetDB = $mailboxdatabases[4].databasename
}
else
{
return $targetdb
}
return $targetdb
}
The next section of new code reads the CSV file stored in the input parameter $CSVDBPath using
Import-CSV and stores the objects in the variable $mailboxdatabases . The if statement that
immediately follows checks if $mailboxdatabases was successfully set. If not, an error message is
passed to the display and the script is exited.
# Read from the database CSV file, if there is a failure reading the file, exit
$mailboxdatabases = (Import-Csv $CSVDBPath)
if (!$mailboxdatabases)
{
Write-Host -fore yellow ???`nFailed to read the database input file. It is either
invalid or improperly formatted.`n???
exit
}
Chapter 15: User, Group, and Public Folder Administration
453
The $logheader variable is updated to include the name of the CSV file used as input for the mailbox
database list.
$logheader = ???
*******************************************************************
Run time = $datetime using input files $CSVUPath & $CSVDBPath
*******************************************************************???
Finally, the character variable arrays used to determine the group to which the current user should be
matched are defined.
Pages:
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627