Note that the display messages have been changed from those used in earlier versions of the script to
handle the ambiguity of multiple input files.
function ValidatePath
{
$validPath = $true
if (($CSVUPath -eq ??????) -or ($CSVDBPath -eq ??????))
{
$validPath = $false
Write-Host -fore yellow ???`nYou must enter the full path to the CSV files
used as input to this script.`n???
return $validPath
}
if (!(test-path -pathType:leaf $CSVUPath) -or
!(test-path -pathType:leaf $CSVDBPath))
Chapter 15: User, Group, and Public Folder Administration
451
{
$validPath = $false
Write-Host -fore yellow ???`nA file path entered is invalid. Please check
file paths and try again.`n???
return $validPath
}
return $validPath
}
A new function called GetDatabase is used to determine the database where the current user ??™ s mailbox
is created. The function starts with a parameter definition to assign the user ??™ s last name to the variable
$lastname . Next, the string variable $firstchar is assigned the value of the first character of the string
stored in the variable $lastname . This is accomplished using the built - in ToCharArray method
available for manipulating string values. Because the method converts the string value to an array, the
first element in the array (the first element is always zero) that holds the first character is de - referenced
using square brackets ( [0] ).
Pages:
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624