none
How to use foreach to load xml content for multiple servers RRS feed

  • General discussion

  • Hi,

    there is a list of servers and I want to use foreach loop to load xml data from each server and produce an output. below is sample script:

    $serverlist = gc ".\list.txt"

    foreach ($server in $serverlist)

    {

    $xml = New-object xml

    $xml.load (\\$server\c$\xmlfile)

    write-host $server: $xml.hardwaretype

    }

    • Changed type Bill_Stewart Monday, January 7, 2019 8:30 PM
    • Moved by Bill_Stewart Monday, January 7, 2019 8:30 PM Unanswerable drive-by question
    Wednesday, November 14, 2018 7:13 PM

All replies