Set Title on Mail Contact

I have several thousand mail contacts in my AD that i need to set a job title for.  I've tried both the Exchange Set-MailContact cmdlet and the Set-ADObject cmdlet, but neither seem to have a way to set the -Title field.  I need to populate the field with a static text string.
LVL 1
marrjAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ThinkPaperIT ConsultantCommented:
What is your exact code? Are you getting any errors?

You should be able to do it with set-mailcontact or set-contact

http://community.office365.com/en-us/wikis/exchange/579.aspx
0
Will SzymkowskiSenior Solution ArchitectCommented:
You would have to use the "set-contact" cmdlet. Use the following command below to accomplish this...

CSV File layout needs to have 2 columns Heading for Name and Heading for Title

Import-Module activedirectory
Add-PSSnapin Microsoft.Exchange.Management.Powershell.Admin
$ContactList = Import-Csv "c:\[b]youCSVhere[/b]"
foreach ($Contact in $ContactList) {
$Contact.Name
$Contact.Title
Set-contact -Identity $Contact.Name -title $Contact.Title
}

Open in new window


Thanks


Will.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ThinkPaperIT ConsultantCommented:
Correction - will is right, set-contact is what you need.
0
Webinar: Miercom Evaluates Wi-Fi Security

It's not just about Wi-Fi connectivity anymore. A wireless security breach can cost your business large amounts of time, trouble, and expense. Plus, hear first-hand from Miercom how WatchGuard's Wi-Fi security stacks up against the competition in our upcoming webinar!

Will SzymkowskiSenior Solution ArchitectCommented:
I tried to BOLD the $ContactList = Import-Csv "c:\yourCSVhere"

You don't need these in there. simply add your CSV file name between the quotes.
0
marrjAuthor Commented:
Thank you.  My problem was that I did not have both the Exchange snapin and the ActiveDirectory module present.  I had each of them present at different times, but never saw the Set-Contact cmdlet.

Instead of using an input file, I need to query a specific OU and replace the existing title for each contact in the OU.  For some reason, I'm not getting much help from the Get-Help Set-Contact cmdlet.  Do you have an example of what I'm trying to do?
0
Will SzymkowskiSenior Solution ArchitectCommented:
Just do the following...

Get-contact -filter * -searchbase "OU=testou,DC=yourdomain,DC=com" | select name | export-csv "c:\modifyContacts.csv"

Once you have this csv file you just have to add the Title heading in the csv file and put this csv file in the first script I posted.
0
marrjAuthor Commented:
Actually, what I ended up doing was piping the Get-Contact directly to a Where-Object filter then directly to the Set-Contact cmdlet.  Thanks for your help.  I will award you both some points.

Get-Contact -OrganizationalUnit "ou=Students,ou=Albuquerque,ou=Individuals,ou=SupplementalContacts,dc=contoso,dc=com" |
Where-Object {$_.Title -ne "Student Albuquerque"} |
Set-Contact -Title "Student Albuquerque"
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.