Score:0

Is it possible to call one Windows scheduled task from another Windows scheduled task?

az flag

I have created two independent task Windows scheduled task's:

  1. First task running under system-context (needs to run under system-context as application needs to be installed silently) checks if already installed application as any updates on every scheduled interval.

  2. Second task running user-context (needs to run under user-context because when run under system-context its running in background) which open one pop-up for restart.

I want to call second task which is running under user-context only when there is updates available for the application.

If anyone has suggestions it would be much appreciated

Score:1
au flag

The first task may start the 2nd, yes. The syntax would simply be

schtasks /run /TN secondtasksname
Divyashri Rao avatar
az flag
Thanks you. This works
Divyashri Rao avatar
az flag
this scheduler is going to queue state when called from 1st scheduler. When I manually uncheck start task only when computer is on AC its running under condition tab of second scheduler. Is there any way we can add this condition in script?
Bernd Schwanenmeister avatar
au flag
You confuse me. Your 2nd task does run ok when the condition "start only on AC power" is removed? Then remove it, what's the problem? Are you trying to modify that 2nd task by means of a script? That could be done by simply deleting and recreating that 2nd task from a saved xml file using schtasks /create /TN secondtaskname /xml \\server\share\somexml /f
Divyashri Rao avatar
az flag
Thank you. Sorry for that. Yes that's correct I want to do it from 2nd task scheduler script. Can you please help me with the steps to create xml?
Bernd Schwanenmeister avatar
au flag
The xml is created when you export the 1st task after having unchecked "start only on AC power" - as easy as that.
Divyashri Rao avatar
az flag
Thank you. I tried exporting 1st task and creating 2nd one but the issue is 2nd scheduler as same functionality as of 1st which I don't need. How can I change this?
Bernd Schwanenmeister avatar
au flag
I don't understand. Please rephrase that.
Divyashri Rao avatar
az flag
Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/131731/discussion-between-divyashri-rao-and-bernd-schwanenmeister).
Score:0
im flag
DKU

Yes, The second task can run if any updates are available to install.

For this you can script with IF/ELSE conditions, If no update exist don't trigger the second task, Else script will trigger the second task to install the updates.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.