The value of $databaseNotUp is returned to the command
that called validatePFStore and all processing for the function is complete.
if (!(get-publicfolderdatabase -identity:$PFDatabase -status).Mounted)
{
$databaseNotUp = $true
Write-Host -fore yellow ???`nPublic Folder Database
???$($server.name)\$($PFDatabase.name)??™ is not available. Please check it??™s
status.`n???
return $databaseNotUp
}
The last command in the function executes only if the if statement evaluates false and returns the value
stored in $databaseNotUp , which was set to $false at the beginning of the function.
return $databaseNotUp
The last function called validateFolder is used to validate the need to create a public folder for the
user. The script assumes that if a public folder already exists for the user, there is no need to create a new
folder. To keep track of whether the user is valid, the $hasFolder variable is set to $false . This is the
value that is returned to the command that called validateFolder if the test passes and the need to
create a folder is valid.
#This function validates the need to create a folder for the user specified
function validateFolder
{
$hasFolder = $false
Part IV: Automating Administration
460
The only if statement in this function uses the Get-PublicFolder cmdlet to see if a folder with a name
that matches the name of the user already exists.
Pages:
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638