Solved

remove mail user in mail contact in exchange management shell

Posted on 2009-06-29
3
1,151 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Follow this checklist to learn more about the 15 things you should never include in an email signature from personal quotes, animated gifs and out-of-date marketing content.
Find out what you should include to make the best professional email signature for your organization.
In this video we show how to create a Distribution Group 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 Recipients >>…
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…

832 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