There is no OLE object to work with tasks created by the Scheduled Tasks Wizard (the Win32_ScheduledJob object in WMI only works with tasks scheduled with AT). You can, however, use the schtasks command to produce a list of all scheduled tasks and then walk that list. schtasks can produce the output in several formats, xml probably being the most useful for your purposes.
From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Brzezinski, Paul J Sent: Friday, April 02, 2010 10:05 PM To: perl-win32-users@listserv.activestate.com Subject: TaskScheduler and Win32::OLE I'm trying to use Win32::OLE to access the TaskScheduler [on Win2K3]. I would like to get all the configured tasks, finding any that contain a pattern in the task name and then display all/any details I can about those tasks. I'm using OleView.exe to look at the SCHEDULERLib (Scheduler 1.0 Type Library). Schedule: Scheduler.EnumTask: CLSSID: {056ADD67-DDB0-47BE-9F7D-DC652206F766} TypeLib: {C83F84A8-241A-4837-A6BA-1C5131141743} Library: Win32::TieRegistry=HASH(0x139e35c) 1.0\ => Scheduler 1.0 Type Library Scheduler.Schedule: CLSSID: {4EF17F94-3975-4ACF-B228-29485BDE5860} TypeLib: {C83F84A8-241A-4837-A6BA-1C5131141743} Library: Win32::TieRegistry=HASH(0x13bb3cc) 1.0\ => Scheduler 1.0 Type Library Scheduler.Task: CLSSID: {3AEC7772-2766-4C67-8487-4189C55DDE4E} TypeLib: {C83F84A8-241A-4837-A6BA-1C5131141743} Library: Win32::TieRegistry=HASH(0x13bb45c) 1.0\ => Scheduler 1.0 Type Library Scheduler.Trigger: CLSSID: {D8D9EEBC-0640-47AC-84FF-97C3A6B2FC79} TypeLib: {C83F84A8-241A-4837-A6BA-1C5131141743} Library: Win32::TieRegistry=HASH(0xdc6ff4) 1.0\ => Scheduler 1.0 Type Library I have to say I'm quite lost and have reviewed Jan Dubois' doco on Win32::OLE but just haven't been able to understand it well enough. use Win32::OLE qw(in); $obj = Win32::OLE->new("Scheduler.Schedule") or die "Error OLE:".Win32::OLE->LastError(); $obj->Reset; $obj->Activate; foreach $tsk (in $obj->Invoke( 'EnumAllTask')) { # print $tsk->Name, "\n"; # this generates an error my %NAMES; my @props = map { $_->{Name} } ( in $tsk->{Properties_} ); print "Props = ", join( ", ", @props), "\n"; } # no output is produced -- Paul J. Brzezinski Integration Engineering - GM HP Enterprise Services
_______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs