I am working on a simple powershell script that verify if inside of the xml file the attribute(s) exists. The xml file looks like,
<?xml version="1.0"?>
<Objects>
<Object>
<Property Name="Browser">Firefox</Property>
<Property Name="PDF">Adobe Reader</Property>
</Object>
</Objects>
I want the powershell to verify if the attribute Firefox exists, and then to execute a task afterward.
[xml]$file = get-content C:\Admin\personalsettings.xml
$xmlProperties = $file.SelectNodes("/Objects/Object/Property")
Foreach ($xmlProperty in $xmlProperties) {
$strName = ($xmlProperty | Where-Object {$_.Name -eq "Firefox" }).InnerXml
If ($strName -eq "False")
{
Invoke-Item "C:\windows\protected\browser.exe"
}
}