July 5th, 2011, 05:05 PM
Issues executing powershell commands in C#
I am trying to get our self-service email forwarding process to work in Exchange 2010 (we upgraded from 2003 where everything could be done right in Active Directory using the LDAP API). For 2010 it requires 3 steps. I am using System.Management.Automation which allows me access to the PowerShell class. The first to do is to create the forward contact which I do with a "New-MailContact" powershell command, and that works fine. Next, I want to hide the contact from the GAL which I do with a "Set-MailContact" powershell command. This command merely sets an attribute in the new contact object.
Finally (and this is where my problem is) I need to set the altRecipient attribute in the user object which I do with a "Set-Mailbox" powershell command. It works maybe half the time. The other half I get the following error:
Couldn't find object "catnet.wfo.linfield.edu/People/Contacts/Rob Tanner". Please make sure that it was spelled correctly or specify a different object.
The object does exist and the previous powershell command, to hide it from the GAL, would fail if it didn't. Any idea as to what's going on?
Tags for this Thread
Click Here to Expand Forum to Full Width