Quantcast
Channel: Exchange Server 2013 - Administration, Monitoring, and Performance 论坛
Viewing all articles
Browse latest Browse all 8719

I need to delegate adding contacts to clerical staff

$
0
0

Exchange 2013 running on 2012 R2, Windows 8.1 desktops.

We have a Powershell script the domain admins use to add Exchange contacts. It simply asks for the name of the contact, formats the name, adds the user as a contact, and then adds the contact email address to a MessageLabs import file.

I want to hand this off to the same clerical person that sends the email saying, "add Joe Smith - jsmith@yahoo.com".

What permissions (or anything else) does this user need? The script is below. (And even though I have been dabbling in Powershell for years, I feel I still am a Powershell newbie, so any constructive criticism of the script is welcome, knowing I err on the side of self-documentation over concise - formerly writing in COBOL is a factor here.)  :^)

Rob

# add exchange snap-in
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn
$today         = (get-date).Date
# create messagelabs import file when run on new day
$msglabs       = "C:\Users\administrator.MIAT\Desktop\messagelabs.csv"
$lastWriteTime = ((Get-Item $msglabs).LastWriteTime).date
if ($lastWriteTime -ne $today) {New-Item $msglabs -type file -force}
Write-Output "To keep going hit enter, else any key + enter to quit."
$keep_going    = ""
do
{
# get student info interactively
$contact_fname = Read-Host "First name"
$contact_fname = $contact_fname.Trim();
$contact_lname = Read-Host "Last  name"
$contact_lname = $contact_lname.Trim();
$contact_forwd = Read-Host "Forward to"
$contact_forwd = $contact_forwd.Trim();
# set up mail alias
$contact_fname = $contact_fname.Substring(0,1).ToUpper()+$contact_fname.Substring(1).ToLower()
$contact_lname = $contact_lname.Substring(0,1).ToUpper()+$contact_lname.Substring(1).ToLower()   
$contact_finit = $contact_fname.Substring(0,1)
$contact_cname = $contact_fname + " " + $contact_lname
$contact_alias = $contact_finit + $contact_lname
# create mail contact and messagelabs address record
New-MailContact -ExternalEmailAddress $contact_forwd -Name $contact_cname -Alias $contact_alias -FirstName $contact_fname -Initials '' -LastName $contact_lname
Set-MailContact $contact_forwd -HiddenFromAddressListsEnabled $True
Write-Output (Get-Mailcontact -Filter {DisplayName -eq $contact_cname}).emailaddresses | Select-String "domain.ext"
Add-Content $msglabs ($contact_alias + "@domain.ext")
$keep_going    = Read-Host “Keep going?"
}
while ($keep_going -eq "")
#
$upload_contacts = read-host "Upload new accounts to filtering service daily. Login to messagelabs, services, platform, upload, browse for messagelabs.csv...hit enter when ready"
# go to the messagelabs web site for uploading the new student email contacts
start "https://clients.messagelabs.com"


Viewing all articles
Browse latest Browse all 8719

Trending Articles