# Read variables from XML

**URL:** <https://forums.powershell.org/t/read-variables-from-xml/3342>\
**Category:** PowerShell Help\
**Created:** [October 30, 2014, 5:23am UTC](https://forums.powershell.org/t/read-variables-from-xml/3342 "2014-10-30T05:23:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![john-billekens](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@john-billekens](https://forums.powershell.org/u/john-billekens)\
**Post date:** [October 30, 2014, 5:23am UTC](https://forums.powershell.org/t/read-variables-from-xml/3342/1 "2014-10-30T05:23:54Z")

</div>

Is it somehow possible to read variables and values from xml into an PowerShell script without specifying each of them separately?

For example I’ve set the following variables:

```
arrPostcode @()
arrPostcode += ,@('1234AB', 'City1')
arrPostcode += ,@('4567CD', 'City2')
blnHome = $True
blnNld = $False
intNumbers = 556
strText = 'Something'
```

And I have a xml file like (can be ajusted when required to get a better result):

See Attachment

And say I want to use the ‘default’ values if the xml file was not found, but if the xml file is found I want to use (replace) the variables and values defined in that xml file.

---

<div class="post-metadata">

**Author:** ![john-billekens](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@john-billekens](https://forums.powershell.org/u/john-billekens)\
**Post date:** [October 30, 2014, 5:25am UTC](https://forums.powershell.org/t/read-variables-from-xml/3342/2 "2014-10-30T05:25:33Z")

</div>



---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:46pm UTC](https://forums.powershell.org/t/read-variables-from-xml/3342/3 "2024-05-16T20:46:49Z")

</div>


