Re: Problem running a script on startup

From: Allan Cady (allancady_at_yahoo.com)
Date: 05/26/04

  • Next message: Allan Cady: "Re: Problem running a script on startup"
    Date: 26 May 2004 12:38:30 -0700
    
    

    Interesting suggestions all...

    None of these suggestions work quite as I want, but I made a little
    compromise and went with the Task Scheduler solution. I have it
    working now.

    In case anyone's interested, here's a little more detail on what I'm
    up to, and the hurdles I had to cross to get there.

    I'm administering a web server which is built with a stack of two
    machines, serving different roles. There are services on machine 1
    that need to wait to start until services on machine 2 are ready.
    This is Windows 2000 Server, and we don't have a domain or any other
    network infrastructure that would make cross-machine control easier...
    just two independent machines talking over a LAN.

    Someone suggested I could use psexec
    (http://www.sysinternals.com/ntw2k/freeware/psexec.shtml) for the
    cross-machine communication. I built a vbscript that uses psexec to
    ask machine 2 if it's ready, then once it is, the script runs a bunch
    of NET START commands on machine 1. The script runs just fine from
    the command line. So the next task was to get it to run on system
    start. This was the most difficult challenge.

    The Task Scheduler solution looked promising... I had forgotten that
    it included an option to schedule something on computer startup. The
    problem was, in my original scheme, the Task Scheduler service was one
    of the services that I wanted to start from the script after machine 2
    was ready. So a bit of a bootstrap problem there.

    The startup script capability of the group policy at first looked like
    the better way to go... easy to configure, and it didn't depend on
    Task Scheduler. But when I tried it, I got an error from psexec... it
    couldn't connect to machine 2. I get the following message from
    psexec:

    A specified logon session does not exist. It may already have been
    terminated. Connecting to 192.168.0.145...
    Couldn't access 192.168.0.145:

    I suspect this is related to the fact that the script is running as
    LocalSystem, instead of as an actual user. But I don't know.

    I couldn't find my way around that, so I eventually decided that the
    possible consequences of Task Scheduler starting early were minimal
    enough to tolerate, so I scheduled the script in Task Scheduler. Now
    the script runs fine on startup.

    I haven't tried the service (srvany) option.

    Thanks for the help,

    Allan

    "Dave Patrick" <mail@NoSpam.DSPatrick.com> wrote in message news:<OtQczvMQEHA.3708@TK2MSFTNGP10.phx.gbl>...
    > Use the Group policy editor
    > %windir%\system32\gpedit.msc Computer Configuration\Windows
    > Settings\Scripts\Startup
    >
    > --
    > Regards,
    >
    > Dave Patrick ....Please no email replies - reply in newsgroup.
    > Microsoft Certified Professional
    > Microsoft MVP [Windows]
    > http://www.microsoft.com/protect
    >
    >
    > "Allan Cady" wrote:
    > |I have a script (vbs) that needs to run on system startup, regardless
    > | of whether any user logs on. I thought I knew how to do this, but I'm
    > | not seeing the result I expected.
    > |
    > | I added a registry value in
    > | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run, with
    > | the correct command to run the script. But when I restart the
    > | machine, as far as I can tell, the script isn't getting run until I
    > | log on as an interactive user. (I can tell whether it has run without
    > | logging on.)
    > |
    > | Does anyone have any idea why it's doing this, and more importantly,
    > | what can I do that will make the script run without logging on?
    > |
    > | I'm doing this on Windows 2000 Server.
    > |
    > | Thanks,
    > |
    > | Allan


  • Next message: Allan Cady: "Re: Problem running a script on startup"

    Relevant Pages

    • Re: script will not run as a scheduled service unless logged on
      ... run the script interactively, and I can run the script as a scheduled job ... OK, at this point, when you say *you* are logged on, what account are you ... The task scheduler log does not report the detail of the error. ... I have already given Batch user full access to cscript.exe, ...
      (microsoft.public.windows.server.scripting)
    • Re: Problem running a script on startup
      ... I built a vbscript that uses psexec to ... The script runs just fine from ... The Task Scheduler solution looked promising... ...
      (microsoft.public.win2000.general)
    • Re: Fail to logon to Exchange with CDO 1.21 under local account
      ... there may be an issue running in the task scheduler ... SQL 2000 and the W2K server where the script resides are separate Windows ... Server and runs under a local account. ... dialogue box with fields for the domain user, ...
      (microsoft.public.exchange.applications)
    • Re: rights of a user to run the service "task scheduler"
      ... Is there any chance the task works because the administrator has rights to ... Does the script run ... run task scheduler, the permissions are dependent on what the script is ...
      (microsoft.public.security)
    • Re: Where is prog that closes apps?
      ... >> the Task Scheduler? ... > Unless the app executable has a terminate switch (which would work in Task ... > Scheduler, also), I don't see an option with psexec to terminate an ... C:\Documents and Settings\Lorry>kill Calculator ...
      (microsoft.public.win2000.general)