The first time is asking a question on here, so hopefully it's formatted right.
Long in short a buddy of mine created a script that points to a pre-existing XML document on a server and modifies values.
I need that script to run its self repeatedly with a few values in it changing. The variables will be the server name that the XML is loaded from (i.e. //variable/C$/folder1/folder2/targetXml), and the text of a couple text nodes it creates.
I know it is possible to get said variables to populate with reference to a CSV. My CSV would be 4 columns, 210 rows. Referencing the 210 servers the code is loading an XML from and 3 variable pieces of data that need to be written to each XML.
the structure of the XML across all servers is consistent, so no script needs to be changed for the appropriate values to be modified. i just need to know how to get:
[xml]$GMX = new-object system.Xml.XmlDocument
$XmlPath = "\\server1\C$\file1\Target.xml"
$GMX.load("\\server1\C$\file1\Target.xml")
$PhnNumNode = $GMX.CreateElement("SourcePhoneNumber")
$PhnNumText = $GMX.CreateTextNode("1234567890")
$PhnNumNode.AppendChild($PhnNumText)
$TextNode.AppendChild($PhnNumNode)
to have the server1 become a variable that points to cell 1b of a CSV, and have the phone number 1234567890 become a variable that points to the cell in column c of that same row, respectively. IE 2b + 2c, 3b + 3c, etc. then rerunning its self for every sequential row.
how do I create the variable values and then associate them with the values on the CSV?
Forgive me for my novice, and thanks in advance!