
Chapter 15: User, Group, and Public Folder Administration
455
The following lists the contents of script file newuser-publicfolder.ps1 :
# newuser-publicfolder.ps1
#
# Synopsis: This script creates a Public Folder based on a mailbox enabled user
# account used as an input value to the script. This script has to
# be run by an administrator who is a member of the Exchange Recipient
# Administrators group.
#
# This script checks to see if the user is mailbox enabled and if a
# Public Folder already exists for the user. If not, a folder is
# created named for the user in the default Public Folder database
# specified by the user ’ s mailbox database. The folder client
# permissions are set to allow the user full control over the folder
# contents, and the user running the script is set as the folder owner.
#
# Usage: newuser-publicfolder.ps1 < mailbox enabled user >
#
# Example: newuser-publicfolder.ps1 user1@exchangeexchange.com
param([string]$user)
# Turn off error reporting to the display
$ErrorActionPreference = “SilentlyContinue”
#This function validates the user specified
function validateUser
{
$notValidUser = $false
if ($user -eq “”)
{
$notValidUser = $true
Write-Host -fore yellow “`nYou must enter a mailbox enabled user account as
input to this script.`n”
return $notValidUser
}
if (!($usermb))
{
$notValidUser = $true
Write-Host -fore yellow “`nThe account specified is not mailbox ...