none
enable-mailbox has a parameter -DomainController, how to get this value programatically? RRS feed

  • Question

  • Hi All,

    Enable-Mailbox cmdlet has a DomainController parameter, is there way to get this value programatically? We would like to pass this value when we enable mailbox an AD user.

    Also is there any advantage of providing this value?

    Are there any disadvantages if we don't provide this value.

    Please let me know. Thanks!


    /M

    Thursday, October 25, 2012 5:00 PM

All replies

  • -DomainController <Fqdn> The DomainController parameter specifies the fully qualified domain name (FQDN) of the domain controller that writes this configuration change to Active Directory.

     Setting this lets you speicify the DC that will write the change.  If, for instance, you have many domain controllers that are not well connected the user could have to wait a while before that change is replicated to their local DC and they are able to use the mailbox if the DC the change was originally writting to is at a remote site, and possibly multiple relication hops away.

     


    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

    Thursday, October 25, 2012 5:25 PM
  • Hi njolinor - thanks for the reply. Yes it is for this reason, it is good to use Domaincontroller right ?
    but the question is how to find this programatically, all we know is user's DN and we have only exchange cmdlet? Is there any way we can get this DomainController value? please help. thanks!

    /M

    Thursday, October 25, 2012 5:29 PM
  • I don't know a way to get that programmatically very easily.  That would require searching the DC logs looking for logon events for that user.

     

    Other than that, you might be able to code something to look up the site the user is logged on from and programmatically choose a DC for that site, but you'd need to know the user's workstation name or IP address.

     


    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

    Thursday, October 25, 2012 5:40 PM
  • hmm.. the scenario I am in - I know only user's DN. Nothing else... I was trying to do get-user -Identity <DN>  -ReadFromDomainController -IgnoreDefaultScope | Select OriginatingServer.

    OriginatingServer property should generally hold the Dc name if we provide -ReadFromDomainController flag, but it seems not :(

    it gives incorrect values :(


    /M

    Thursday, October 25, 2012 5:44 PM
  • OriginatingServer property should generally hold the Dc name if we provide -ReadFromDomainController flag, but it seems not :(

     

    The Originating Server property on a returned Mailbox object will be the name of the DC that was queried to get that information.  It is not a property of the mailbox itself, just a property of that instance of the mailbox object.


    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

    Thursday, October 25, 2012 6:00 PM
  • ok - it is not correct to assume OriginatingServer is the user's DC ?

    not sure is there any other way :(


    /M

    Thursday, October 25, 2012 6:23 PM
  • A user can potentially log on from anywhere in the domain, and can even be logged on in multiple locations simultaneously.  It's not predictable, and not easily discoverable in real time. 

    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

    • Proposed as answer by wendy_liuModerator Monday, November 5, 2012 10:45 AM
    • Unproposed as answer by user5796 Monday, November 5, 2012 10:48 AM
    Thursday, October 25, 2012 6:30 PM