Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Good morning!

I have a quick question. How would I delete the mail contact associated with a certain user? This is what I have tried:

Get-Mailbox 'jsmith' | select ForwardingAddress | Remove-MailContact

This throws a command piping error:

The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do
 not match any of the parameters that take pipeline input.
    + CategoryInfo          : InvalidArgument: (@{ForwardingAdd...ding/J Smith}:PSObject) [Remove-MailContact], ParameterBindingException
    + FullyQualifiedErrorId : InputObjectNotBound,Remove-MailContact

I then tried this, just in case:

Get-Mailbox 'jsmith' | select ForwardingAddress | Remove-MailContact $_

And received this:

Cannot bind argument to parameter 'Identity' because it is null.
    + CategoryInfo          : InvalidData: (:) [Remove-MailContact], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Remove-MailContact

However, if I run just this:

Get-Mailbox 'jsmith' | select ForwardingAddress 

I'm given this response:

----------------- Forwarding/J Smith

The names have been changed to protect the innocent.

Clearly, I'm not that great with Exchange powershell, but I'm learning haha. I'm assuming the issue is because the data returned from select ForwardingAddress is not an identifier Remove-MailContact will accept. However, there are only two 'Forwarding' properties of Get-Mailbox.

share|improve this question
up vote 1 down vote accepted

First, the ForwardingAddress property does not have to correspond to a Mail Contact. (I have several that list other mailboxes and quite a few that list distribution groups). Just remember that as we continue.

The problem is your use of the SELECT verb and how it is returning a portion of the property instead of the full object. Try: Remove-MailContact $(Get-Mailbox "jsmith").ForwardingAddress

This is getting the object that is the forwarding address. Another alternative (if you don't mind multi-lining it) would be:

$mailbox = Get-Mailbox "jsmith"
$forward = $mailbox.ForwardingAddress
Remove-MailContact $forward

Remember that all of this assumes the ForwardingAddress is referencing an object of type MailContact, which isn't guaranteed (it can be any type of Direcotry.ADObjectId)

share|improve this answer

I believe you are looking for Disable-MailUser <username>, which will disable the email account portion of the account, but leave the AD user account intact.

If you are looking to remove the email attributes of a contact that does not have a User account in Active Directory, then you are looking for Disable-MailContact <username>.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.