XML Help

This topic contains 1 reply, has 2 voices, and was last updated by  Poshoholic 5 years ago.

  • Author
  • #8051



    Using ADSI I have a variable containg my domains.  I can easily access the domainname using $domain.properties.dnsroot format.

    What I want to do is use this information to populate a drop-down list.  I thought I'd use convertto-xml and then bind the drop-down.  Issue is, I do not know how to access the domainname from this xml variable/document.

    The convertto-xml produces something similar to


    < ?xml version="1.0"?>
    LDAP://something1 dnsroot domain1 adspath LDAP://something2
    LDAP://something3 dnsroot domain2 adspath LDAP://something4
    LDAP://something5 dnsroot domain3 adspath LDAP://something6


    Any idea on how I can access domain1, domain2 and domain3 from the above file ? Or is there a better way ?

    Thanks in advance.

  • #8061


    I wouldn't convert to XML. Just do something like this:

    $domainNames = @($domains | ForEach-Object {$_.properties.dnsroot})

You must be logged in to reply to this topic.