System.Xml.XmlDocument.SelectNodes
is not working for Windows Task Scheduler XML. Below is an excerpt of the XML:
<?xml version="1.0" encoding="UTF-8"?>
<Task version="1.3" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2014-12-03T13:58:05.5136628</Date>
<Author>ABCCORP\jsmith</Author>
</RegistrationInfo>
</Task>
The following code does not find the Task element:
[xml]$xml = gc C:\temp\myxml.xml
$xml.SelectNodes("/Task") #returns nothing
But if I remove the namespace from the XML, then it works:
<?xml version="1.0" encoding="UTF-8"?>
<Task version="1.3">
<RegistrationInfo>
<Date>2014-12-03T13:58:05.5136628</Date>
<Author>ABCCORP\jsmith</Author>
</RegistrationInfo>
</Task>
How can I make this work?