none
Task Scheduler for opening program: "arguments not valid" RRS feed

  • Question

  • Hi all,

    I hope I'm posting in the right forum - this seemed like the most appropriate one. I also reviewed the answered questions on Task Scheduler, and while one or two might apply to me, I don't know enough about Windows scripting to be sure.

    I'm trying to use Task Scheduler to automatically open a program called LoggerNet at a scheduled interval. I run a remote Arctic weather station that powers on a communications device for 2 hours every week. I've set up LoggerNet, the software used for communicating with the station's datalogger, to automatically connect to the station over the internet and transfer the most recent week of data to a server at my university lab. This works well, so long as the program is open on my computer at the specified time, but if I forget to open the program one week, we risk losing a week's worth of data.

    I'd like to automate the opening of the program using Task Scheduler (which I learned about recently, and hadn't used before). I've found the GUI to be approachable, and using the "Create Basic Task" wizard, I created the basic task with the name “LoggerNet Scheduled Collection” and a lengthy description.

    The task runs daily, opening LoggerNet at 10am (program directory: "C:\Program Files (x86)\Campbellsci\LoggerNet\ToolBar.exe"). The task is set to run whether I’m logged on or not, with highest privileges, configured for Windows 10. The task will start on AC or battery power, will wake the computer to complete the task if necessary, and will start even if the computer doesn’t have some form of network connection (hopefully seeing it open will prompt me to get on a network if possible). In case of initial failure, the task will retry every 5 minutes for the whole 2hr window, and the task will be stopped after 2 hours. If LoggerNet is already open, the task will not start a new instance of the program.

    Unfortunately, when I try to initialize it, it tells me that “One or more of the specified arguments are not valid.” I can open the program without difficulty outside of the scheduler, and setting the program's properties to always run with administrator privileges has had no effect. I don't think it can be an issue with the program, because I get the same error for other programs with the same setup - I also tried a PDF reader and Notepad++.

    I'm currently running Windows 10 on a Dell XPS laptop at the moment, and will eventually be running this task on a Windows 8 server.

    I don't know what to try next, and I appreciate any help.

    Thanks very much,

    Keegan Smith

    Tuesday, June 14, 2016 5:24 PM

All replies

  • Hi,

    can you please paste a screenshot of the task config for review ?

    Here's an example of a program and argument configured correctly

    also, if your program has a UI and needs to run interactively, I would suggest to only run it when a user is logged on or the task might fail. You would have to take care about logging on somewhere else


    David Sebban | Nelite North America | My Blog : http://dsebban.wordpress.com | Follow me on twitter : http://twitter.com/davidsebban

    Tuesday, June 14, 2016 8:03 PM
  • Hi David,

    Thanks for responding so quickly! Unfortunately I can't post screenshots yet, because the forum managers have yet to verify my account (I've requested this both by email and by responding to the relevant sticky thread, but nothing's happened). So I'll have to describe it.

    I originally used the default entry produced after using "Browse", which appears in "Program/script" as:

     "C:\Program Files (x86)\Campbellsci\LoggerNet\ToolBar.exe"

    with no additional arguments or "Start in" directory. I then dropped the string quotes and directory reference to match your format above. "Program/script" was then populated with just:

    ToolBar.exe

    This didn't work either. The program does have a UI, so I also tried configuring with "logged on" as the only option, but still, no dice. The program that I'm trying to open acts as a "front end" for a suite of other programs, but it's still a .exe that can open standalone, so that shouldn't provide any problems for the task scheduler.

    I also tried moving the directory to the "Start In" box - nothing.

    This program shouldn't need any additional arguments - in the command prompt, if I set directory to C:\Program Files (x86)\Campbellsci\LoggerNet, then enter ToolBar.exe, the program opens immediately.

    Another user suggested that it might be because it's a 32-bit program being used in a 64-bit system, but I'm inclined to think that the problem is more fundamental to the Task Scheduler - I've learned that I can't even create a scheduled task capable of opening Notepad. Frustrating.

    What do you think? Can I provide any other information that helps? I really appreciate this.

    Cheers,

    Keegan

     

    Tuesday, June 14, 2016 11:46 PM
  • Hi KeeganSmith,

    We could refer to the following link to verify the account.
    How to Verify Your MSDN/TechNet Forums Account So that You Can Post Images and Links
    http://social.technet.microsoft.com/wiki/contents/articles/15960.how-to-verify-your-msdntechnet-forums-account-so-that-you-can-post-images-and-links.aspx

    As a workaround, we could upload the screenshot to Onedrive and paste the link here(delete the underline and it will be allowed to paste).

    Have you ticked the "Do not store password " or choose "Run only when user is logged on "?

    Best regards


    Please mark the reply as an answer if you find it is helpful.

    If you have feedback for TechNet Support, contact tnmff@microsoft.com

    Wednesday, June 15, 2016 6:46 AM
    Moderator
  • Hi Meipo,

    Thanks - I had already followed the instructions in that link, sending the email to fissues at microsoft dot com and being told to post on the "Verify your account" sticky thread. Still nothing, but the OneDrive approach should work - hopefully you can see this image of the action setup for my scheduled task:

    https://onedrive.live.com/redir?resid=5FD0648FDFFA82E1!532&authkey=!AIkUQl2YcGBR6iI&v=3&ithint=photo%2cpng

    I independently found resolution (kind of): if I use "Create Task" (i.e. NOT the wizard), and get all details correct, then it works. But if I modify the task in any way after it's been created, or try to export and re-import as an XML, the tool throws an "invalid argument" error. This is frustrating. I have tested this more than once, with other configurations and other programs (e.g. system32/notepad.exe) and it's consistent - no changes allowed after the initial configuration. Is this a normal problem? Is there any way I can modify a task once I've created it?

    As for the logged on/not logged on issue, it would be preferable for me to be able to run it whether logged on or not, since I'm using a lab machine that can't be left logged in or without security due to significant public traffic in the lab. If I configure as "logged on only", the GUI opens. If I configure as "whether logged on or not", the task runs without the GUI. The program is running invisibly, though - attempts to open the GUI manually fail, returning "communications server is already running" (see picture below).

    https://onedrive.live.com/redir?resid=5FD0648FDFFA82E1!533&authkey=!AJIaGxT8a4pPkMw&v=3&ithint=photo%2cpng

    In both the interactive and the "invisible" states, the scheduled data acquisition runs, so the tasks do exactly what I want. When ending the invisible task, there is a hidden "loggernetservice.exe" that has to be manually killed from the task manager, otherwise the communications server error above is returned on every call to the program (preventing this task from cycling without user oversight - undesirable). Presumably, to use the non-GUI version of the tool, I would need to schedule a second task to kill this program after the communications window closes. I can't see a built-in "close program" option in Task Scheduler, so would I need to call a script to kill that program? Or maybe that can be built into the "additional arguments" option?

    Thank you very much for the help, from both of you. I appreciate that this may be a "rookie mistake", but I am still looking for a way to modify a task once it's been built. Having to create a new one every time is not difficult, but tedious. Can I use Task Scheduler to automatically log me onto a machine? From Googling it, I’m not sure if that’s possible.

    Cheers,

    Keegan

    Wednesday, June 15, 2016 4:19 PM
  • Hi KeeganSmith,

    So now it is available to create a task?
    "so would I need to call a script to kill that program?"
    It seems that we have to.

    " Can I use Task Scheduler to automatically log me onto a machine? "
    What is the main purpose?
    If you don`t want to input password to login, we could run "control userpasswords2" then untick the "user must enter a name and password to use this computer".

    Best regards


    Please mark the reply as an answer if you find it is helpful.

    If you have feedback for TechNet Support, contact tnmff@microsoft.com

    Thursday, June 16, 2016 8:05 AM
    Moderator
  • Hi Meipo,

    Yes, the task worked! At 10AM, the task ran, opening the program GUI, at 10:06, my weather station opened cell communications with me, and at 10:11, my data table appeared on my hard drive!

    Re: scripting the kill task: I'll talk to folks in my lab who can guide me on this - it's over my experience base.

    Re: logging in: the purpose is for using a shared machine, where I save to a personal network directory which is activated when I log in. So, no login, no saving. But I have a workaround: we can save files to the hard drive temporarily (can't keep it there long-term - it's scrubbed daily), and then I'll schedule a task to email the file to me. Looks like Task Scheduler's email function has been deprecated, but we can probably write a send email line into the same script that kills the program, to do it all in one go.

    The one remaining question is: is it possible to modify a script after it's been created? It doesn't seem to work for me, sending that "invalid arguments" error.

    Thanks,
    Keegan


    Thursday, June 16, 2016 9:12 PM
  • Hi KeeganSmith,

    How did you modify the task? Have you tried to restart the machine?

    I have tried to export and import a task on my machine and it could work well.

    Best regards


    Please mark the reply as an answer if you find it is helpful.

    If you have feedback for TechNet Support, contact tnmff@microsoft.com

    Friday, June 17, 2016 8:26 AM
    Moderator
  • Hi Meipo,

    Attempted task modification by right-click, "Properties", changing parameters. Once I click "OK", I get "invalid arguments". For importing and exporting it's the same thing - even an unmodified task returns "invalid arguments" when I hit "OK" to complete the import. After an update and restart, the problem persists.

    Could this be a Windows10 issue? I've set the tasks configured for Windows10 with highest privileges, and set LoggerNet to run with administrator status at all times.

    Cheers,

    Keegan


    Keegan Smith

    Friday, June 17, 2016 5:21 PM
  • Hi KeeganSmith,

    I have tried to modify the task schedule from the properties and export and import. Both of the operation could work well.

    Please open an administrator command line and run "sfc /scannow" to check the health of system files. Turn off the antivirus software temporarily.

    Please try to login with another account to have a troubleshoot at the same time.

    Best regards


    Please mark the reply as an answer if you find it is helpful.

    If you have feedback for TechNet Support, contact tnmff@microsoft.com


    Monday, June 20, 2016 8:02 AM
    Moderator
  • Hi Meipo,

    Thanks for the suggestion! I ran the System File Checker both with and without antivirus software - no issues found. I also tried editing the task while the antivirus software was turned off - no better luck. I don't have any other local accounts on this machine, and normally sign in using the administrative account. Would you suggest I try starting a new Microsoft account to do this testing?

    Thanks,

    Keegan


    Keegan Smith

    Monday, June 20, 2016 7:46 PM
  • Hi KeeganSmith,

    Are you the administrator of this machine?

    If you are administrator of this machine, we could create a new local administrator account to have a troubleshoot.

    By the way, it is recommended to use the built-in administrator account. That account is usually used to troubleshoot and it is recommended to disable that account.

    Best regards


    Please mark the reply as an answer if you find it is helpful.

    If you have feedback for TechNet Support, contact tnmff@microsoft.com


    Tuesday, June 21, 2016 2:32 AM
    Moderator
  • Hi Meipo,

    Yes, I am the administrator and sole user. I tried switching from my Windows account (which has administrator privileges) to a new local administrator account. I cannot modify or import the task using this new local account either.

    I'm not sure what you mean by "it is recommended to use the built-in administrator account. That account is usually used to troubleshoot and it is recommended to disable that account." Does that mean I should only use the local administrator account for troubleshooting and otherwise disable it?

    Thanks,

    Keegan


    Keegan Smith

    Wednesday, June 22, 2016 1:03 AM
  • Hi KeeganSmith,

    Have you updated to the latest version Windows 10.10586.420?

    "Does that mean I should only use the local administrator account for troubleshooting and otherwise disable it?"

    Yes. The built-in "administrator" account is usually used to troubleshoot issue, it is disabled by default and it is recommended to keep it disabled.

    Best regards


    Please mark the reply as an answer if you find it is helpful.

    If you have feedback for TechNet Support, contact tnmff@microsoft.com


    Friday, June 24, 2016 6:23 AM
    Moderator
  • Hi Meipo,

    Yes, I'm running 10.10586.420. My laptop originally shipped with Windows 8, but I immediately updated to 10 and have kept up with updates ever since. Not sure what to do from here on out - has anyone else reported this issue?

    Thanks,

    Keegan


    Keegan Smith

    Friday, June 24, 2016 4:03 PM
  • Hi Keegan,

    Someone reported the same issue few months back at Microsoft Answers, but we couldn't fix it.

    Is this issue is seen only for a particular account? You can try creating a new local account (administrator) to test.


    Ramesh Srinivasan  |  The Winhelponline Blog

    Friday, June 24, 2016 4:23 PM