Solved

remove mail user in mail contact in exchange management shell

Posted on 2009-06-29
3
1,146 Views
Last Modified: 2012-05-07
Hi,
first I 'd like to find a script to remove mail user in mail contact in exchange management shell.

And I have script to enable a user mailbox.
Enable-MailUser -Identity 'AD.LOCAL/MIS/test' -Alias 'test' -ExternalEmailAddress 'SMTP:test@mail.com'
I'd like to put them together and run in exchange management shell.
My questions is when I run test.ps1 it showed me a error message, "The term 'enable_mail_yantest.psl' is not recognized as a cmdlet, function, operable program, or script file. Verify the term and try again."

Please help,
Thanks,
0
Comment
Question by:luyan
  • 2
3 Comments
 
LVL 20

Accepted Solution

by:
EndureKona earned 500 total points
ID: 24737228
Try this...this works for me:

Remove-MailContact aliasofcontact
Enable-MailUser test -Alias test -ExternalEmailAddress SMTP:test@mydomain.com

This only makes contacts...are you looking to have the test user account to have a mailbox on the exchange database?
0
 

Author Comment

by:luyan
ID: 24739605
Yes, I'd like to have the test user account have a mailbox on exchange.

Thx
0
 

Author Comment

by:luyan
ID: 24739809
when I run
Remove-MailContact aliasofcontact
it said
Object could not be found on domain controller.
So I tried command,
REmove-mailuser test

it is successful with some option 'y' 'a', n'',...

but when I run,
Enable-MailUser test -Alias test -ExternalEmailAddress SMTP:test@mydomain.com
it said,
object /ad/mis/test' could not be found on domaincontroller
I thought remove-mailuser removed user account as well, right?

Can I run them in batch file and silently?

Remove-Mailuser aliasofcontact
Enable-MailUser test -Alias test -ExternalEmailAddress SMTP:test@mydomain.com

Thanks,

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
In this video we show how to create a mailbox database in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Servers >> Data…
This video discusses moving either the default database or any database to a new volume.

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now