Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

enum scheduled tasks running as . . .

8 views
Skip to first unread message

TwistedPair

unread,
Oct 16, 2003, 1:36:52 PM10/16/03
to
Hi all,
Can anyone tell me how to enumerate scheduled tasks and the username under
which they run? I checked the Win32_ScheduledJob WMI class, and didn't see
it.

Thanks,
Pair


Ray at <%=sLocation%>

unread,
Oct 16, 2003, 1:59:34 PM10/16/03
to
Not that this helps, since you seem to have already discovered this, but
read this quote.

"Note: WMI can only enumerate scheduled tasks created with the
Win32_ScheduledJob class or the At.exe utility. It cannot enumerate tasks
created using the Task Scheduler."
(http://www.microsoft.com/technet/scriptcenter/schedule/Scrsch03.asp)

Ray at work

"TwistedPair" <twist...@mail.com> wrote in message
news:u5%23zXwAl...@TK2MSFTNGP10.phx.gbl...

TwistedPair

unread,
Oct 16, 2003, 2:26:38 PM10/16/03
to
Perhaps I could enumerate a registry value . . . I will research that
approach further, and if it works, I will post data.

Thanks,
Pair

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:etcAD9Al...@TK2MSFTNGP12.phx.gbl...

TwistedPair

unread,
Oct 17, 2003, 10:15:21 AM10/17/03
to
Weird, I hadn't played with Scheduled Tasks before, but it appears all the
information about that task is basically held in the scheduled task icon. I
didn't find ANYTHING in the registry at all. Any ideas from anyone?

Thanks,
Pair

"TwistedPair" <twist...@mail.com> wrote in message

news:eoBgMMBl...@TK2MSFTNGP10.phx.gbl...

Joe Fawcett

unread,
Oct 17, 2003, 11:30:54 AM10/17/03
to
"TwistedPair" <twist...@mail.com> wrote in message
news:euPCckLl...@TK2MSFTNGP09.phx.gbl...
Some code to enumerate, I'm working on a way to get info, other than AutoIt
:)
var CONTROL_PANEL = 0x3;

function getFolderItems(FolderName)

{

var oShellApp = new ActiveXObject("Shell.Application");

var oFolder = oShellApp.NameSpace(CONTROL_PANEL);

var colItems = oFolder.Items();

var enumItems = new Enumerator(colItems);

for (;!enumItems.atEnd();enumItems.moveNext())

{

var oItem = enumItems.item();

if (oItem.Name == FolderName) break;

}

if (oItem.IsFolder)

{

oFolder = oItem.GetFolder;

return oFolder.Items();

}

return null;

}

function main()

{

var colTasks = getFolderItems("Scheduled Tasks");

}

main();

--

Joe


Michael Harris (MVP)

unread,
Oct 17, 2003, 8:19:36 PM10/17/03
to
TwistedPair wrote:
> Weird, I hadn't played with Scheduled Tasks before, but it appears
> all the information about that task is basically held in the
> scheduled task icon. I didn't find ANYTHING in the registry at all.
> Any ideas from anyone?
>


Scheduled Tasks are stored actually as *.job files in the C:\WINNT\Tasks
folder (whose contents are displayed in Windows Explorer via a shell
extension). The *.job file format in binary, so you need to use the
published COM interfaces to access a task (i.e. a *.job file).

SDK Documentation
Task Scheduler (Task Scheduler: Platform SDK)
http://msdn.microsoft.com/library/en-us/taskschd/taskschd/task_scheduler_start_page.asp

These COM interfaces aren't accessible directly from script. You'll need to
write a COM component capable of using them (the SDK examples are all C++)
or use a public domain component. One such public domain component is
available at:

WSH Scripting [Mark Pryor]
http://mysite.verizon.net/res1ur2j/

Click on "Script Mstask" in the toc...


--
Michael Harris
Microsoft.MVP.Scripting

Windows 2000 Scripting Guide
Microsoft® Windows®2000 Scripting Guide
http://www.microsoft.com/technet/scriptcenter/scrguide/sagsas_overview.asp

TechNet Script Center Sample Scripts
http://www.microsoft.com/downloads/release.asp?ReleaseID=38942

WSH 5.6 documentation download
http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en

0 new messages