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

Enumerates scheduled tasks created under Task Scheduler

512 views
Skip to first unread message

Toomany

unread,
Jan 19, 2005, 3:32:10 AM1/19/05
to
I need to list all task create in the Task Scheduler using vbscript.

I found on the MS Script Center the following script:

http://www.microsoft.com/technet/scriptcenter/scripts/os/tasks/ostkvb04.mspx

But as the description Say :

Enumerates all the scheduled tasks on a computer. Note: WMI can only
enumerate scheduled tasks created using the Win32_ScheduledJob class
or the At.exe utility. It cannot enumerate tasks created using the
Task Scheduler.

Anybody know a solution to list task create in the Task Scheduler ?

THX

Torgeir Bakken (MVP)

unread,
Jan 19, 2005, 3:27:22 PM1/19/05
to
Toomany wrote:

Hi

'--------------------8<----------------------

Set oFSO = CreateObject("Scripting.FileSystemObject")
sWinDir = oFSO.GetSpecialFolder(0)

Set oShellApp = CreateObject("Shell.Application")

Set oTasksFolder = oShellApp.Namespace(sWinDir & "\Tasks")

For Each oTaskItem In oTasksFolder.Items
sTaskName = oTaskItem.Name
If sTaskName <> "Add Scheduled Task" Then
WScript.Echo sTaskName
End If
Next

'--------------------8<----------------------

--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx

toomanymessi

unread,
Jan 20, 2005, 2:49:59 AM1/20/05
to
Thanks for your solution it's a godd idea but It will only shown the
Name first column "name" that in fact is the same name of a standard
folder.

There is a way to show all other column ? (status, last scheduled,
etc...) I had try to change .name into .statut but of course is not
recognise....

Any idea ?

Torgeir Bakken (MVP)

unread,
Jan 20, 2005, 3:23:37 PM1/20/05
to
toomanymessi wrote:

Hi

You could parse the output from the command line tool SCHTASKS.EXE
on WinXP and Win2k3 Server.

If you are using Windows 2000 SCHTASKS.EXE won't be there, but you
can use JT.EXE that is available here:
ftp://ftp.microsoft.com/ResKit/win2000/

More about JT.EXE here:
http://www.jsiinc.com/subf/tip2600/rh2621.htm

toomanymessi

unread,
Jan 21, 2005, 2:24:39 AM1/21/05
to
To parse it, there is way to do it withour rediret the result into a
temp file to parte it , but directly do it in memory ?

Torgeir Bakken (MVP)

unread,
Jan 21, 2005, 3:51:46 PM1/21/05
to
toomanymessi wrote:

> To parse it, there is way to do it withour rediret the result into a
> temp file to parte it , but directly do it in memory ?
>

Hi

Well, you have the Exec method that was introduced with WSH 5.6 that
provides access to the StdIn/StdOut/StdErr streams, but I always
prefer to redirect to a temp file and then parse it, see an example
on this here:

http://groups.google.co.uk/groups?selm=ea54829eEHA.3632%40TK2MSFTNGP11.phx.gbl

toomanymessi

unread,
Jan 24, 2005, 2:45:38 AM1/24/05
to
Ok, Thanks, I did it with a templ file and that work fine.
Thanks for your help

Toomany

0 new messages