Re: TaskScheduler and Win32::OLE
http://search.cpan.org/~UNICOLET/Win32-TaskScheduler2.0.3/TaskScheduler.pm http://taskscheduler.sourceforge.net/ El 02/04/2010 11:05 p.m., Brzezinski, Paul J escribió: 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 ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: alarm
One big reason why it doesn't work: THANKS $MICROSOFT. In the early days of NT, they decided to only permit system calls and drivers to interrupt system calls so that a user process could no longer crash the system (think Windows 3.x). So it has never been possible to implement 'alarm' unless the perl code was talking to a hardware driver (e.g Win32::SerialPort - the driver has API calls to set the timeouts). It appears you_know_who relented a bit with Win2K and provided a 'job timeout' that could be setup from user code. So you want to look at the Win32::job module on CPAN. -bill On Fri, 2010-04-02 at 16:56 -0400, Paul Rogers wrote: Trying to run the code below in Win32, any reason why it may not be working? Behaviour: It just sits there and doesn't time out as expected. Cheers, Paul --- my $timeout = 10; eval { local $SIG{ALRM} = sub { die alarm\n }; alarm $timeout; print Hit ENTER key within $timeout seconds: ; $buf = ; alarm 0; }; if ($@) { die unless $@ eq alarm\n; # propagate unexpected errors # timed out } else { print else\n; } ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: alarm
-Original Message- From: Bill Birthisel [mailto:bbirthi...@aol.com] Sent: Saturday, April 03, 2010 9:42 AM To: Paul Rogers Cc: perl-win32-users@listserv.ActiveState.com Subject: Re: alarm One big reason why it doesn't work: THANKS $MICROSOFT. In the early days of NT, they decided to only permit system calls and drivers to interrupt system calls so that a user process could no longer crash the system (think Windows 3.x). So it has never been possible to implement 'alarm' unless the perl code was talking to a hardware driver (e.g Win32::SerialPort - the driver has API calls to set the timeouts). Well, I guess we'll have to live with it. It appears you_know_who Señor Gates. relented a bit with Win2K and provided a 'job timeout' that could be setup from user code. So you want to look at the Win32::job module on CPAN. Yep...and that's exactly what was recommended by Jan in the link sent by Joachim Thuau. Cheers! Paul --- ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: TaskScheduler and Win32::OLE
I should have stated that I did first try to download this module - it's missing from the Activestate repository. So I downloaded the source and attempted to compile and it's _broken_. It hasn't been updated in several years and according to the CPAN testers site this module fails to compile - so it's not just me. -- Paul J. Brzezinski Integration Engineering - GM HP Enterprise Services From: Marcial Borde [mailto:marcialbo...@adinet.com.uy] Sent: Saturday, April 03, 2010 8:23 AM To: Brzezinski, Paul J Cc: perl-win32-users@listserv.ActiveState.com Subject: Re: TaskScheduler and Win32::OLE http://search.cpan.org/~UNICOLET/Win32-TaskScheduler2.0.3/TaskScheduler.pm http://taskscheduler.sourceforge.net/ El 02/04/2010 11:05 p.m., Brzezinski, Paul J escribió: 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.commailto:Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
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
RE: TaskScheduler and Win32::OLE
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
Re: TaskScheduler and Win32::OLE
On 3 April 2010 22:21, Brzezinski, Paul J paul.brzezin...@hp.com wrote: I should have stated that I did first try to download this module – it’s missing from the Activestate repository. So I downloaded the source and attempted to compile and it’s _broken_. It hasn’t been updated in several years and according to the CPAN testers site this module fails to compile – so it’s not just me. ppm installs fine for me with 5.10 with the additional repositories: C:\Perl\Programsppm install Win32-TaskScheduler Downloading ActiveState Package Repository packlist...done Updating ActiveState Package Repository database...done Downloading bribes packlist...done Updating bribes database...done Downloading trouchelle packlist...done Updating trouchelle database...done Downloading uwinnipeg packlist...not modified Downloading Win32-TaskScheduler-2.0.2...done Unpacking Win32-TaskScheduler-2.0.2...done Generating HTML for Win32-TaskScheduler-2.0.2...done Updating files in site area...done 9 files installed Just in ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs