Jump to content

Would you like to see a brushed up Task Scheduler UDF (inlcuding help files, examples ...)?  

41 members have voted

  1. 1. Would you like to see such a brushed up UDF?

    • Yes
    • Don't mind
    • Maybe later
      0
    • No
      0


Recommended Posts

Posted (edited)

I'm able to connect to another computer with the Task Scheduler GUI and the UDF, but my AD account is in an AD group that is in the local Administrators group on that server.  

In the example for _TS_TaskList, I changed the folder path to "\" due to "\Microsoft\Windows\Plug and Play" folder not existing on the Server 2008 R2.  i was able to get task lists from the following with the UDF connecting from. 

Windows 7 -> Server 2008 R2

Windows 10 -> Server 2008 R2  

Windows 7 -> Server 2012 R2

Windows 10 -> Server 2012 R2  

Windows 7 -> Windows 7

Windows 7 -> Windows 10

Windows 10 -> Windows 7

Windows 10 -> Windows 10

Server 2008 R2 -> Server 2012 R2

Server 2012 R2 -> Server 2008 R2

Server 2008 R2 -> Server 2008 R2

Server 2012 R2 -> Server 2012 R2

Note: These are all in the AD domain.

Update: I was also able to connect to a non-domain Server 2012 R2 with "." for the domain and using the local Administrator account.  

 

Adam

Edited by AdamUL
Posted
  On 8/30/2019 at 4:07 PM, AdamUL said:

In the example for _TS_TaskList, I changed the folder path to "\" due to "\Microsoft\Windows\Plug and Play" folder not existing on the Server 2008 R2.

Expand  

The folder "\Microsoft\Windows\Plug and Play" does not exist on my computer either (Win7 Pro SP1).

I am using "\Microsoft\Windows\Media Center" instead ("\" also works, of course).

Musashi

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Posted

I have updated the example scripts and hope the new folders and tasks exist on all MS OSs.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted
  On 8/30/2019 at 4:07 PM, AdamUL said:

i was able to get task lists from the following with the UDF connecting from.

Expand  

Thanks a lot for testing. So the right permissions need to be set to connect to another computer ;)

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

Hello, everyone. :)

@AdamUL

Would you be so kind as to post a working call for domain computers and (more importantly) one for non-domain computers?

For example with the "_TS_TaskList.au3"?

; *****************************************************************************
; Connect to the Task Scheduler Service
; *****************************************************************************
;~ Global $oService = _TS_Open()
Global $oService = _TS_Open("TestPC1", "TestUser1", ?, "1234")
Posted

 

:welcome: to the English AutoIt forum  ... Lieber Professor

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

If anyone finds some docu about debugging the task creation process by COM I would be very grateful.
I just get an 0x80020009 (General Exception). This could be anything.
The COM error handler only provides some cryptic info like "(32,4):Actions:" when the Taskedefinition.Principal.UserId is missing 😡

I checked the event logs but didn't find anything.
_WinAPI_GetLastError returns nothing as well.

I would be grateful for any information!

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

It's not a problem related to a specific code. It's a general problem that the Task Scheduler COM interface does not provide an easy to understand error message.
I get error descriptions in the mentioned format but with different content.
I was not able to find a documentation explaining what "(32,4):Actions" or similar messages mean :(

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

I have started to write the first wrapper function to create time based task schedules.
To limit the number of parameters the function will only provide a few time related triggers.

The following parameters are supported at the moment:

  • Folder where the schedule gets saved
  • Name of the schedule
  • Type of trigger ($TASK_TRIGGER_TIME - run the task at a specified time, $TASK_TRIGGER_DAILY - run the task every day, $TASK_TRIGGER_WEEKLY - run the task every week)
  • Start and end date/time when the trigger gets activated
  • Days of week for TASK_TRIGGER_WEEKLY: Use this to run a task every week on Monday till Friday
  • Interval between the days or weeks in the schedule (for $TASK_TRIGGER_DAILY and $TASK_TRIGGER_WEEKLY). Example: Set this parameter to 2 to run a schedule every second say/week.

This should cover most of the time related requests. If you need more you have to use the general task creation function (not coded yet).

What do you think?
Do you miss anything in this wrapper?

 

 

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

Alpha version 0.2.0.0 released

Changelog can be found on the download page and the history in the ZIP file.

For download please see my signature below

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

@water Your welcome, glad I could help.  

@Professor_Bernd Here are some examples of _TS_Open that I used to connect to the different computers.  

;Connect to a computer in AD where the current user is in a the local Admininstrators group 
;on that computer, via domain or local group, or directly.  Use AD computer name.
Global $oService = _TS_Open("COMPUTERNAME")

;Connect to a computer in AD where the entered user (AdminUser) is an AD user, and is in a the 
;local Admininstrators group on that computer, via domain or local group, or directly.  Use AD computer name.
Global $oService = _TS_Open("COMPUTERNAME", "AdminUser", "AD", "Password") 

;Connect to a computer in AD where the entered local user (Administrator) is NOT an AD user, 
;and is in a the local Admininstrators group on that computer, via local group, or directly.  Use AD computer name.
Global $oService = _TS_Open("COMPUTERNAME", "Administrator", ".", "Password") 

;Non-domain computer where the entered local user (Administrator) is in a the local Admininstrators group 
;on that computer.  Use IP address or DNS name to connect.
Global $oService = _TS_Open("192.168.0.1", "Administrator", ".", "Password")

 

Adam

 

Posted
  On 9/3/2019 at 1:54 PM, AdamUL said:

;Connect to a computer in AD where the entered user (AdminUser) is an AD user, and is in a the
;local Admininstrators group on that computer, via domain or local group, or directly.  Use AD computer name.
Global $oService = _TS_Open("COMPUTERNAME", "AdminUser", "AD", "Password") 

Expand  

With AD computer name, do you mean e.g. "PC007" or "PC007$"? AD uses a trailing $ to identify computers (at least for LDAP queries).

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

Great! I will add your examples to the wiki!

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

What do you think of the first Wrapper function in the 0.2.0.0 release of the UDF?

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

I have started a section in the wiki for the UDF: https://www.autoitscript.com/wiki/TaskScheduler

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

I see you are using:

AutoItSetOption("MustDeclareVars", 1)

Which is used at runtime.

But here:

#AutoIt3Wrapper_AU3Check_Parameters=-w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7

You are not using this parameter:

  Quote
-d : as Opt("MustDeclareVars", 1)
Expand  

proposal: please use AU3Check like this:

#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7

This will check the requirement for declaring variables also when Au3Check processing files.

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Done.

My UDFs and Tutorials:

  Reveal hidden contents

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...