The if statement executes and the
script exits. If the user does not already have a folder, the result returned by validateFolder is false,
and the if statement is skipped.
# Validate the user needs a folder created
if (validateFolder) { exit }
If the script has made it to this point, then the user is a valid mailbox - enabled user, the default public
folder for the user is available, and the user does not already have a public folder.
The next code segment creates the public folder using the New-PublicFolder cmdlet. The input value
for the Name parameter is taken from the full username stored in the Name property of the object stored
in $userMB . The Path parameter value uses a static value that assumes all new user folders are to be
created under the root folder corporate . The Server parameter value is taken from the server name
stored in $server .
The results of running New-PublicFolder are stored in the variable $newFolder as a public
folder object.
# Create the folder, exit if folder creation fails for any reason
$newFolder = New-PublicFolder -Name:$usermb.name -Path:???\corporate??? `
-Server:$server -ErrorVariable err
At this point if the public folder fails creation, there is no need to continue and attempt to set permissions
on a public folder that does not even exist.
Pages:
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642