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:
ForwardingAddress
-----------------
ObfuscatedDomain.com/E-mail 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.