0

I have this XML file below which I need to edit.

<?xml version="1.0"?>
<rdwastr:strings xmlns:rdwastr="urn:microsoft.com:rdwastrings">
  <string id="PageTitle">RD Web Access</string>
  <string id="NoScriptWarning">
    <p id="NoScript1">RD Web Access requires JScript. This Web browser either does not support JScript, or scripts are being blocked.</p>
    <br/>
    <br/>
    <p id="NoScript2">To find out whether your browser supports JScript, or to allow scripts, see the browser's online Help.</p>
  </string>
  <string id="HeadingRDWA">RD Web Access</string>
  <string id="HeadingApplicationName">RemoteApp and Desktop Connection</string>
  .
  .
  .
  <string id="PrivateComputer">I am using a private computer that complies with my organization's security policy.</string>
  <string id="MoreInformation">More information...</string>
  <string id="PrivateMore">By selecting this option you can save your credentials so that they can be used in the future when connecting to these programs. Before you select this option, please ensure that saving your credentials is in compliance with your organization's security policy.</string>
  <string id="HideMore">Hide additional information...</string>
</rdwastr:strings>

There are several examples online but I haven't gotten a result so far, here what I've tried lastly. Apparently the semicolon can be a problem.

$xml = [xml](Get-Content \\$client.xyz.com\C$\Windows\Web\RDWeb\Pages\en-US\RDWAStrings.xml)
$node = $xml."rdwastr:strings".string | where {$_.id -eq 'HeadingApplicationName'}
Write-Host $node
$node.Value = "whatever"

Write-Host does not return anything so I'm assuming the previous statement doesn't return anything and assign it to the node. How do I solve this?

3

My experience playing around w/ XML is limited, to say the least, but how about something like:

$node = $xml.strings.string | where { $_.id -eq "HeadingApplicationName" }
Write-Host $node.'#text'
$node.'#text' = "whatever"

Seemed to work in my limited testing...

  • 1
    Yes that was correct, all the examples I've seen was getting the "Value", "#text" was the key here, thanks. – user2629636 Dec 23 '14 at 19:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.