troubleshooting Question

RDG - XML. Configuration settings

Avatar of ivan rosa
ivan rosaFlag for United States of America asked on
PowershellXMLServer Software
4 Comments1 Solution19 ViewsLast Modified:
Hello Folks, (For the sake of the purpose I reduce the actual code in the XML just to enough for the core of the script to run)

I have this ServersList.csv
displayNamename
VirtualPC1192.168.1.10
VirtualPC2192.168.1.11

In which I intend to replace the properties (displayName, Name) within the this Servers.rdg file. which basically is a XML file:
<?xml version="1.0" encoding="utf-8"?>
<RDCMan programVersion="2.7" schemaVersion="3">
  <file>
    <credentialsProfiles />
    <properties>
      <expanded>True</expanded>
      <name>NorthServers</name>
    </properties>
    <group>
      <server>
        <properties>
          <displayName>VirtualPC</displayName>
          <name>10.10.10.15</name>
        </properties>
      </server>
      <server>
        <properties>
          <displayName>VirtualMachine</displayName>
          <name>10.20.90.7</name>
        </properties>
      </server>
    </group>
  </file>
  <connected />
  <favorites />
  <recentlyUsed />
</RDCMan>

Open in new window

I have attempted todo so like by creating this PowerShell Script:
$vms = Import-Csv -LiteralPath "C:\Temp\ServersList.csv"
[xml]$Template  = Get-Content -Path 'C:\Temp\ServersQ.rdg'
$servers = $Template.RDCMan.file.group.server.properties 

$Template.RDCMan.file.group.server.properties = $vms

Open in new window

Which throws me an error: "The property 'properties' cannot be found on this object. Verify that the property exists and can be set."

is this not the way to manage an XML file, do I need something like a 2D array? what is the best practice ?

Any Advise?


Thanks for looking
Ivan Rosa
ASKER CERTIFIED SOLUTION
Coralon
Senior Citrix Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 4 Comments.
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>

Mike

Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 4 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004