name -Path:???\corporate??? `
-Server:$server -ErrorVariable err
If ($err -ne $null) { $err; exit }
$newFolder
# Set permissions on the folder
Add-PublicFolderClientPermission -Identity:$newFolder `
-User:$usermb.alias -AccessRights:Editor -Server:$server
Examining the newuser - publicfolder.ps1 Script
After the usual lines of comment, the script starts by defining the input parameter variable $user to
hold the name of the mailbox - enabled user account entered when the script is run.
param([string]$user)
As was the case in previous scripts described in this chapter, the automatic variable
$ErrorActionPreference is set to SilentlyContinue so default error messages are not displayed.
Instead, the script generates its own error messages as appropriate.
# Turn off error reporting to the display
$ErrorActionPreference = ???SilentlyContinue???
The first function definition called validateUser is used to check the user specified in $user to see if it
is indeed a mailbox - enabled user account. The script assumes the administrator only wants to create
public folders for users and not contacts or mail - enabled users. To keep track of whether the user is
valid, the $notValidUser variable is set to $false . This is the value that is returned to the command
that called validateUser if all tests pass and the user is valid.
Pages:
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633