At times, you will require to read your data in XML format using Powershell Script. Possible reason to do that is such that you can amend the XML file without editing your original Powershell Script. That’s provided that the standardized Powershell Script can fulfill your requirements.
To cater for More flexibility, you can actually insert Powershell Script within your XML. Here is how you can perform that.
Note that this required a minor change in your Powershell Script. (Not to worry, you only need to edit this once and for all).
$xml = [xml](Get-Content .\yourxml.xml)
$expression = $xml.Scripts.script
#Optionally you can put a foreach loop to run each of your script
Below is the simple xml of mine
<script> Write-Host "Halo"; Write-Host "Testing";