We help IT Professionals succeed at work.
Get Started

How extract two tags from an XML export of schtasks.exe

Last Modified: 2016-04-18
Hello -

  I need to generate a list of Windows Scheduled tasks on a server.  I need the Registration Date and the Task Name.  If I use:
schtasks /query /xml >c:\temp\tasks.xml
Each task is returned and those two tags are included.

<!-- \test_of_date -->

The best option would be able to run that command and only ask for those two tags.  Another option would be to read the resulting file and grab just those two tags.

Any idea how I can do this?  I have investigated the Powershell module PowerScheduledTasks, but it doesn't seem to add any functionality beyond schtasks.exe

Example from the file:

<!-- \test_of_date -->
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
    <Principal id="Author">
  <Actions Context="Author">
      <Title>hello world</Title>
      <Body>hello world</Body>

Open in new window

Watch Question
Top Expert 2014
This problem has been solved!
Unlock 1 Answer and 9 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE