I am new to PowerShell scripting and as I was trying to execute the command present inside the XML tag through PowerShell script, I am getting that command printed as a text rather than being executed.
<Task>
<RegistrationInfo>
<URI>\Power\Test</URI>
</RegistrationInfo>
<Principals>
<Principal id="Author">
<UserId>S-1-5-21-928065147-2950777667-2078638527-1001</UserId>
<LogonType>InteractiveToken</LogonType>
</Principal>
</Principals>
<Settings>
<DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
<Enabled>false</Enabled>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<IdleSettings>
<Duration>PT10M</Duration>
<WaitTimeout>PT1H</WaitTimeout>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
</Settings>
<Triggers>
<CalendarTrigger>
<StartBoundary>2017-02-13T17:30:00+05:30</StartBoundary>
<ScheduleByDay>
<DaysInterval>1</DaysInterval>
</ScheduleByDay>
</CalendarTrigger>
</Triggers>
<Actions Context="Author">
<Exec>
<Command>notepad.exe</Command>
</Exec>
</Actions>
</Task>
And when I try the below mentioned PS script I am not getting the desired output.
$xml = [xml](Get-Content "C:\Users\ACER\Desktop\Test.xml")
$xml
$xml.Task
$xml.Task.Actions.Exec.Command