Solved

remove mail user in mail contact in exchange management shell

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

Free book by J.Peter Bruzzese, Microsoft MVP

Are you using Office 365? Trying to set up email signatures but you’re struggling with transport rules and connectors? Let renowned Microsoft MVP J.Peter Bruzzese show you how in this exclusive e-book on Office 365 email signatures. Better yet, it’s free!

Join & Write a Comment

We are happy to announce a brand new addition to our line of acclaimed email signature management products – CodeTwo Email Signatures for Office 365.
Resolve DNS query failed errors for Exchange
To show how to generate a certificate request 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 >> Certificates…
how to add IIS SMTP to handle application/Scanner relays into office 365.

707 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

17 Experts available now in Live!

Get 1:1 Help Now