Vbscript in startup folder runs twice

I'm having a bit of a strange issue with a script placed in the startup folder on a windows 7 machine. When windows loads, it runs 2 copies of the script at the same time. Both scrips error out because as they try to access certain files they find they're "in use." By the other script I'm assuming. I'm wondering why the script is getting double executed, and how I can stop it.

Right after the scripts error out, if you manually click the script in the startup folder it runs with no issues. Only on startup does it run twice and not work.

Thanks in advance for your help,
6 answers Last reply
More about vbscript startup folder runs twice
  1. When you say "startup folder", which folder specifically do you mean?
  2. Hi :)

    And which Vb SCRIPT ???

    None should be running on startup...

    All the best Brett :)
  3. assuming the vbscript is not triggering from one of the "run" or "runonce" registry keys....

    windows 7 will look at two startup folders when started -
    one for you at
    C:\Users\" your username"\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
    one for all users at
    C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup

    make sure the shortcut to the script is not in both startup folders
  4. Thanks to everyone that has commented so far, I should have been more specific: it's in the "all users" startup folder at c:\programdata\microsoft\windows\start menu\programs\startup

    It is not in the user specific folder, and this is happening on the first boot following a sysprep, so there wouldn't be any registry keys starting the second instance of the script as the registry was just scrapped and rebuilt.

    To answer an earlier question: the script is something I wrote to automate several post imaging processes, and is working fine with the 4 other models of computers we're it using on. Also, the real brain bender for me is that it was working fine on this model as well until just the other day. We've already imaged around 100 of these where it worked fine, then suddenly it started running into this problem. The image has not changed - and after it's pushed everything else is present and working. It just executes the script twice on the first boot after the sysprep process finishes.

    It's probably not the end of the world really, as most of this model is already imaged and done. It's just... I don't understand what is happening here. After the script tries to run twice and errors out, if you restart the machine it works as intended. It is isolated to the first boot after sysprep, and is happening consistently.

    Any ideas?
  5. odd. Anything else changed - any chance you use login scripts that might be copying / parsing the all users\startup folder? Unlikely as that would only affect all the models of computers you are using, but..
  6. How long does the script take to run? If it's fairly short then it's possible that it's always been running twice on all your systems and you just haven't seen the problem because the timing is such that the two copies don't try to access the common file(s) at exactly the same time.

    I'm not very familiar with Sysprep, but is it possible that the script is running once because it's in the startup folder, and a second time because it's getting invoked by some kind of Sysprep "run once after setup" configuration?
Ask a new question

Read More

Configuration VBScript Windows 7