XML Help

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

  • Author
    Posts
  • #8051

    ratty67
    Participant

    Guys,

    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

    [code]

    < ?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

    [/code]

    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

    Poshoholic
    Participant

    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.