I was wondering if someone could help me, I am trying to list Scheduled Tasks from a specific user (Admin) on the local computer using the TaskScheduler Class (http://www.co
i doubt you can do this. windows tasks will be common for all the users please correct me if im wrong. but you can get the created user of the perticuler task or els you will be able to get the execution user of the particuler computer.
but this will be differ when it comes to diffrent OS. such as windows 7 windows xp.
This only works for tasks created and configured for Windows 2003, XP, Windows 2000.
If you select for Windows 7, Windows 2008 or Windows Vista, Windows 2008 the jobs don't get stored with a .job
extension in the C:\Windows\Tasks
directory. They get stored in C:\Windows\System32\Tasks
directory with no file extension and in XML format.
The DLL fails to retrieve those configured for Windows 7, Windows Vista, Windows 2008.
There doesn't seem to be a way to specify a user name when performing the query (only a machine name), but you can filter the results yourself using the Creator
property:
foreach (string taskName in st.GetTaskNames()) {
using (Task task = st.OpenTask(taskName)) {
if (task.Creator == "username") {
listBox1.Items.Add(taskName);
}
}
}