none
Bat Script sometimes does not run on startup RRS feed

  • General discussion

  • Hello everyone,

    I've created a batch file that installs all the software we have here at our company. Since Windows 10 picks its own laptop name which mess up our process since we have a naming convention for our devices. I have to get the scripts to add it to the domain and change computer name, reset it then run the second part of the script, since some of our software need the computer name up to standard.

    The issue arises where the sometimes the second script won't even run upon computer startup. The second script is run from Task Scheduler with highest privilege, I've set the auto sign in with the local admin username and password. 80% of the time it works fine. But there's a certain batch of computers that won't get script to run at all and I can't seem to find the pattern. All of these computers are Dell Windows 10 starting patch 1709 (idk why, we always have to run 1803 right afterward).

    Is there a way to guarantee this script to run. I've had instances of some of our admin just let the script run, go to a meeting and come back 1 hour later just to realize that the second script did not run as intended. There's no history in TaskSched showing that the script is ever run.

    General layout of script:

    Initial script (Run from network drive): Download everything then run the 1st installation script.

    1st script: Check if computer is win10, if so, change name add to domain create registry for auto-login then restart (if win7 proceed to installation and done)

    2nd script: (Win10 only) Launched by Task Sched with highest priv, run all installations, put file where they suppose to be, delete registries then done. This is the script that has issue launching.

    Thanks ahead!


    Benedict Wolf

    • Changed type Bill_Stewart Monday, July 29, 2019 7:59 PM
    • Moved by Bill_Stewart Monday, July 29, 2019 8:00 PM Not a scripting question
    Tuesday, December 18, 2018 2:59 PM

All replies

  • If the script works interactively, then you don't have a scripting question (i.e., your question is not on topic for this forum).


    -- Bill Stewart [Bill_Stewart]

    Tuesday, December 18, 2018 3:10 PM
  • What is in "Last Run Result"?

    Check the task scheduler log: Applications and Services Log-Microsoft-Windows-TaskScheduler/Operational

    Tuesday, December 18, 2018 3:23 PM
  • Hi Bill,

    Thanks for the reply. User only need run the initial script then the rest will run themselves until the second script ends. 80% of the time it goes all the way to the end but sometimes, tasksched doesn't launch the 2nd script so user ends up have to manually run it.

    If this is still unrelated, which other forum do you think this question is best fit for?

    Thanks!


    Benedict Wolf

    Tuesday, December 18, 2018 3:28 PM
  • User only need run the initial script then the rest will run themselves until the second script ends. 80% of the time it goes all the way to the end but sometimes, tasksched doesn't launch the 2nd script so user ends up have to manually run it.

    Right - so this is not a scripting question (since the script works).

    If this is still unrelated, which other forum do you think this question is best fit for?

    I'm not really sure. I would recommend searching.


    -- Bill Stewart [Bill_Stewart]


    Tuesday, December 18, 2018 5:34 PM
  • Bill, can you move this thread to the Windows 10 General forum?
    Tuesday, December 18, 2018 5:45 PM
  • I would prefer not to do so, since it is common for admins of other forums to see the word "script" and reflexively move it back.

    I think it is better for the OP to create a new, concise post and note that it's not a scripting question up front.


    -- Bill Stewart [Bill_Stewart]

    Tuesday, December 18, 2018 7:16 PM