Prev | Current Page 613 | Next

Joezer Cookey-Gam, Brendan Keane, Jeffrey Rosen, and Jonathan Runyon

"Professional Windows PowerShell for Exchange Server 2007 Service Pack 1"


Now that the first character is stored in $firstchar , the value can be used to test a series of character
arrays to determine to which group the user belongs. The character arrays are created later in the script,
but must be referenced in the function when it is defined. To test the arrays, an if and a series of elseif
statements are used to test whether the given character array contains the character stored in
$firstchar .
Before the tests begin, the variable $targetDB is used to store a null value that can be returned to the
command that called the function in case all the tests fail. The first test is made by an if statement that
checks whether the character array variable $a2f contains the value stored in $firstchar . If the result
of this test is true, then $targetDB is set to the databasename property of the first mailbox database
object stored in array variable $mailboxdatabases . The array $mailboxdatabases is set later in the
script by reading the CSV file that contains the list of mailbox databases.
If the first test in the if statement is false, then the next test is made using an elseif statement. An
elseif statement is used as an alternative statement that is processed when an if statement evaluates
false. A series of elseif statements can be used for different tests, one after the other following an if
statement.


Pages:
601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625
for your soul Chuck Mangione Sarah McLachlan Ive Mendes Mark Morrison