none
Windows Server 2016 Directory Services ForestMode Enumeration - 'Unknown'

    Question

  • Namespace:   System.DirectoryServices.ActiveDirectory
    OS - Windows Server 2016 RTM
    Role - Directory Services
    Issue Category - .Net Framework ForestMode Enumeration
    .Net Version - .NET Framework 4.6.2
    Issue- When trying to enumerate the "forestmode" of the 'xyz.com' forest from a stand-alone member server (Windows Server 2016 RTM non-domain joined server) using the below commands, the output comes out as 'Unknown'. However, when I run the (Get-ADForest).ForestMode on the root domain controller itself, the output comes out as 'Windows2016Forest'. Why is this discrepancy? What is the solution, if there is one? When can we except the correct value be returned via the .Net way?

    $ForestContext = New-Object System.DirectoryServices.ActiveDirectory.DirectoryContext('forest','xyz.com','user@xyz.com','Password')
    $ForestInfo = [System.DirectoryServices.ActiveDirectory]::GetForest($forestcontext)
    $forest.ForestMode

    "Unknown"
    • Edited by Tarun Rajvanshi Tuesday, January 17, 2017 2:16 PM updated .net version
    Tuesday, January 17, 2017 2:10 PM

All replies

  • Hi,
    I am not quite sure what the problem you are suffering is.
    Based on my understanding of ForestMode Enumeration, if you run ForestMode Enumeration on a non-domain server, as there is no forest running, the output is unknown which seems to be reasonable for me. Please see: https://msdn.microsoft.com/en-us/library/system.directoryservices.activedirectory.forestmode%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396
    In addition, I would suggest you have a try posting questions in the .Net Framework forum:
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?category=netdevelopment
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    Best regards,
    Wendy


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Wednesday, January 18, 2017 6:12 AM
    Moderator
  • Hi,
    Thanks for posting the reply. My apologies if I did not elaborate the problem correctly. However, in my case the forest is running (xyz.com). I am trying to enumerate the forestmode of the xyz.com forest from a standalone server (which is not part of xyz.com domain as yet), while creating a directorycontext object by authenticating  with the enterprise admin of xyz.com forest. I expect "Windows2016Forest" as the output, however it comes out as 'Unknown'. Interestingly when I run Get-ADForest on the DC of xyz.com, i do get the desired output, which makes me believe that .Net is not returning the correct the value for the forestmode. And is only happening in the case of Windows Server 2016 DCs. The DCs of earlier operating systems does return the correct values as shown in the article you have shared in your reply.

    BTW, i have posted the same question on .net forum as well.

    Regards,

    Tarun Rajvanshi

    Wednesday, January 18, 2017 8:36 AM
  • Hi Tarun,
    Appreciate for your feedback and update, and we are glad to hear that you have also posted in related forum, hope that some good share about this issue will be returned.
    And we will keep our eyes on this thread,too and you will receive update if any is done.
    Best regards,
    Wendy

    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Thursday, January 19, 2017 2:09 AM
    Moderator