Jump to content

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

40 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

@AdamUL
Thanks for posting the working _TS_Open() with remote PCs.
I have a question:
"Whenever I try to use the .Connect method with a remote PC, prompting the remote PC name, the Domain name, the Username and the Password, an error pops up with the following code and description: 800A0046 - Permission denied".
Googling around, I didn't see any topic talking about .Connect method. 
Which settings should I check on the Remote PC and/or about the account I'm trying to connect to the Remote PC?
Thanks :)

Click here to see my signature:

  Reveal hidden contents

 

Posted

It might depend on the Windows version you run on the source and target machine.
Please check the remarks here: https://docs.microsoft.com/en-us/windows/win32/taskschd/taskservice-connect

I'm sure it might be a permission problem as well. Still searching ...

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted
  On 9/5/2019 at 8:04 AM, water said:

It might depend on the Windows version you run on the source and target machine.

Expand  

The Task is running on Windows Server 2016.
Unfortunately, the error 800A0046 is not listed in the Remarks about .Connect method.
By the way, this error appears when I run the script as a VBScript, while when I run it through VBA, the error code is 70 - Permission Denied.
Thanks for helping :)

Click here to see my signature:

  Reveal hidden contents

 

Posted

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted (edited)

It helped a bit, because the setting "Remote Scheduled Tasks Management" wasn't checked, and I tried to connect from the Task Scheduler to the remote PC (successfully), but I still have issues using the VBScript :ermm:

EDIT: without providing the Username, the Password, and the Domain parameters, it successfully connects to the remote PC.
Checked if those parameters are correct, and they are.
Just for information:

  • the Username was set as "Username", without the trailing domain name;
  • the Password was correct;
  • the Domain name was set as the Domain in which the User resides.

Were these parameters set correctly, or was I missing something?
Thanks :)

Edited by FrancescoDiMuro

Click here to see my signature:

  Reveal hidden contents

 

Posted
  On 9/5/2019 at 8:11 AM, FrancescoDiMuro said:

Unfortunately, the error 800A0046 is not listed in the Remarks about .Connect method.
By the way, this error appears when I run the script as a VBScript, while when I run it through VBA, the error code is 70 - Permission Denied.

Expand  

Errorcode 800A0046 (QWord Hex) => 70 (Word Dec)
C:\Users\Username>net helpmsg 70
Result : Der Remoteserver wurde angehalten oder wird gerade gestartet.
(The remote server has been stopped or is being started.)

If you enter "800A0046 permission denied" at google you get various results, for example
https://stackoverflow.com/questions/56117328/vbscript-error-code-800a0046-permission-denied

No idea whether that's helpful or not 🤔 (the errorcode topic is a PITA anyway).

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 (edited)

@Musashi
Thanks for the hints!
As I wrote above, without prompting the Username (in the correct form Domain\Username), the Password, and the Domain name, it works.
Fun fact, the user who access to the remote PC is the same that runs the script from another PC; maybe some permission set on the PC itself?
I was curious about why would it throw that error.

Whatever, this could be useful if someone else would ever have this issue :)

Edited by FrancescoDiMuro

Click here to see my signature:

  Reveal hidden contents

 

Posted

I have started to create the XML import and export functions.

They allow to

  • Export a task as XML to a file
  • Export a task to an array which will be returned to the calling script
  • Import a task from a file
  • Import a task from an XML array or string passed as parameter from the calling script

Anything else the functions should be able to do?

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted (edited)

Will it be possible to move existen task to New folder? 

Edited by mLipok

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 (edited)
  On 9/5/2019 at 2:48 PM, water said:

Anything else the functions should be able to do?

Expand  

Excuse me if I'm being stupid, but... create a task?

(I was hoping not to deal with xml... I hate it with an irrational passion :))

Edit: He's looking for help as Francesco mentioned. I'll take a look tonight for documentation, I can't wait for this!

Edited by seadoggie01

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

  Reveal hidden contents
Posted (edited)
  On 9/5/2019 at 4:40 PM, mLipok said:

Will it be possible to move existen task to New folder? 

Expand  

The Windows Task Scheduler does not provide a method to move tasks.
But with the XML Export/Import it is easily possible. Export the task to a file or array, import the  file/array and specify the new task path. If successful delete the "old" task.
I will soon release the new functions so you can play with them ;)

Edited by water

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted
  On 9/5/2019 at 6:20 PM, seadoggie01 said:

Excuse me if I'm being stupid, but... create a task?

Expand  

There are no stupid questions, just unasked questions ;)

At the moment I'm in the design stadium. The Windows Task Scheduler has so many properties that I'm looking for an easy way to let a user set them ALL without going crazy.
Right now I'm working on this central function which will be a worker function for other functions to create and modify tasks.
As a task might have a collection of triggers and actions I might need to implement functions to create them too.

Another way is to create wrappers supporting just a subset (as the new _TS_WrapperDateTime does).

Let's see what the near future brings :)

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted
  On 9/5/2019 at 9:06 AM, FrancescoDiMuro said:

Were these parameters set correctly, or was I missing something?

Expand  

Looks good. I too tried to connect to my local computer ... the result was that my account got locked - something went wrong with userid/password.
Seems connecting to another computer will be something we will figure out when everything else is rock-stable.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

Seems strange that _TS_FolderCreate returns the created folder object, _TS_FolderExists returns T/F, but there is no _TS_FolderGet returning the folder object... do we ever need the folder object or just the path? :)

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

  Reveal hidden contents
Posted

_TS_FolderGet has been added. I was a bit hesitant at first because the function only consists of a single line.
For completeness sake I added the function ;)

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

Alpha version 0.3.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
  On 9/6/2019 at 7:00 AM, water said:

_TS_FolderGet has been added. I was a bit hesitant at first because the function only consists of a single line.
For completeness sake I added the function ;)

Expand  

I don't mind if the function is there, it just seemed like there should only be one type returned, the object or the path.Alternately, you could accept both paths/objects and always convert with that one line :)

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

  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...