Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

Issue with c# code enabling mailbox using remote powershell

$
0
0

Hi All,

We are in a difficult situation. Please help. Below are the details.

We have 2 different c# applications. One for managing AD accounts, this uses ADSI. No issues whatsoever even if have multiple domains (parent/child/peer) in a forest.

Second application is to manage exchange mailboxes. For 2010, we use remote powershell as recommended by Microsoft. We make use of Enable-Mailbox, Set-Mailbox, Disable-Mailbox cmdlets. We don't use New-Mailbox as the Ad user is already created by AD c# application.

Exchange server is setup such that a single exchange server manages multiple domains in the forest.

For example:-

Domain1 - Exchange server is installed.

Domain2 - No exchange server is installed but users in this domain also have mailboxes in the above exchange server.

To mail enable mailbox a AD user we use Enable-Mailbox -Identity <Identity_value>.

If the Ad user belongs to domain2 and before replication happens among DCs, if we try to do enable-mailbox -Identity <user_in domain2>, we will get error saying user not found in domain1 DC.

So, we will have to execute enable-mailbox -Identity <user_in_domain2> -DomainController domain2_dc. this should work.

But how do we get domain2_dc value??

We are trying Get-User -Identity <user_in domain2> -ReadFromDomainController -IgnoreDefaultScope | Select OriginatingServer.

Actual Questions:-

  • Is this property 'OriginatingServer' will always point to DC where the AD user resides?
  • Is this correct assumption?
  • If not, how do we get correct DC of user by pragmatically?

Please help. Let me know if more information is required.

Thanks.


/M


Viewing all articles
Browse latest Browse all 7132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>