Sorry, I don't have a Windows 2003 Server to test this on. However, I do
have an XP virtual machine, and schtasks is indeed available, although the
/XML option is not. So if XML isn't available on Win2K3, use a different
format, like CSV. 

 

From: perl-win32-users-boun...@listserv.activestate.com
[mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of
Brzezinski, Paul J
Sent: Saturday, April 03, 2010 10:55 AM
To: Howard Tanner
Cc: perl-win32-users@listserv.activestate.com
Subject: RE: TaskScheduler and Win32::OLE

 

Respectively, XML might be an option for Vista and above, but I'm talking
about W2K3 server.  Yes, I should have stated I looked at the WMI method and
dismissed that because it only gets the tasks added to the system via the AT
command.

 

The OLE objects are different between W2K3/XP and older vs. Vista/Win7/W2K8
and up, when I realized this I stopped trying to figure out the TaskLibrary
1.1 interface.

 

I'm looking to be able to do this in-process instead of any kind of
shell-out to launch schtasks.  My original issue still stands.

 

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.

 

 

 

-- 

Paul J. Brzezinski

Integration Engineering - GM

HP Enterprise Services

 

From: Howard Tanner [mailto:tan...@optonline.net] 
Sent: Friday, April 02, 2010 10:41 PM
To: Brzezinski, Paul J
Cc: perl-win32-users@listserv.activestate.com
Subject: RE: TaskScheduler and Win32::OLE

 

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

Reply via email to