1
General Software Discussion / WinSendKeys (Automate Task Scheduler)
« on: November 09, 2012, 08:38 PM »
I have been trying to automate importing a task into Task Scheduler, to be run from a user account which has no password.
This requires [Enter] be pressed to confirm there is no password, before schtasks accepts the task.
A user account with a password would resolve the problem, but this is not an option.
NT AUTHORITY\SYSTEM would be accepted as a user without a password, but this is not an option either.
The syntax for importing the task (in my case) is this:
schtasks /create /xml "X:\task.xml" /ru "COMPUTER NAME\USER NAME" /tn "Imported Task"
To deal with the multiple quotes, the parameters are assigned to a variable PRMTRS.
Although schtasks %PRMTRS% works as expected, when I try to use WinSendKeys to launch schtasks with the parameters, wait a few seconds and then send [Enter], it doesn't work. This is (among several other variations) is the line I have tried:
WinSendKeys -x schtasks -xp %PRMTRS% -xd 5000 {ENTER}
I'd appreciate some advice.
"X:\task.xml", "COMPUTER NAME\USER NAME" and "Imported Task" are generic placeholders.
In reality, "COMPUTER NAME\USER NAME" might be "John's Computer\John Smith".
This requires [Enter] be pressed to confirm there is no password, before schtasks accepts the task.
A user account with a password would resolve the problem, but this is not an option.
NT AUTHORITY\SYSTEM would be accepted as a user without a password, but this is not an option either.
The syntax for importing the task (in my case) is this:
schtasks /create /xml "X:\task.xml" /ru "COMPUTER NAME\USER NAME" /tn "Imported Task"
To deal with the multiple quotes, the parameters are assigned to a variable PRMTRS.
Although schtasks %PRMTRS% works as expected, when I try to use WinSendKeys to launch schtasks with the parameters, wait a few seconds and then send [Enter], it doesn't work. This is (among several other variations) is the line I have tried:
WinSendKeys -x schtasks -xp %PRMTRS% -xd 5000 {ENTER}
I'd appreciate some advice.
"X:\task.xml", "COMPUTER NAME\USER NAME" and "Imported Task" are generic placeholders.
In reality, "COMPUTER NAME\USER NAME" might be "John's Computer\John Smith".