Announcement

Collapse
No announcement yet.

WSH logon script only runs if there's user interaction

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • WSH logon script only runs if there's user interaction

    I'm working on rolling out a new GPO and I noticed that the logon script doesn't seem to be functioning properly. I narrowed it down and I'm really bewildered by what's going on. First off, if the script is run manually, everything works perfectly. When run as a logon script, however, nothing happens unless there is a WScript.Echo in the script. In that case, everything above WScript.Echo will complete, but anything after the last echo is ignored.

    This is driving me seriously batty. Any ideas?

  • #2
    Re: WSH logon script only runs if there's user interaction

    Originally posted by spectre240sx View Post
    I'm working on rolling out a new GPO and I noticed that the logon script doesn't seem to be functioning properly. I narrowed it down and I'm really bewildered by what's going on. First off, if the script is run manually, everything works perfectly. When run as a logon script, however, nothing happens unless there is a WScript.Echo in the script. In that case, everything above WScript.Echo will complete, but anything after the last echo is ignored.

    This is driving me seriously batty. Any ideas?
    W/out able to to see the code, the only answer I can give is to read this thread,
    http://forums.petri.com/showthread.p...234#post118234

    \Rems

    This posting is provided "AS IS" with no warranties, and confers no rights.

    __________________

    ** Remember to give credit where credit's due **
    and leave Reputation Points for meaningful posts

    Comment


    • #3
      Re: WSH logon script only runs if there's user interaction

      Thanks a bunch. I've disabled "Run logon scripts synchronously" and that solved the problem. I doubt I would have found it on my own.

      Also, one of the things we have running in the script is setting the background via bginfo. Since the synchronous option forces the desktop to wait for scripts to load, there may have been a conflict there.
      Last edited by spectre240sx; 25th September 2008, 19:23.

      Comment


      • #4
        Re: WSH logon script only runs if there's user interaction

        Cool.

        Glad to be of help.

        \Rems


        FYI
        When the logon script runs synchronously, every process that was launched from within the script will be terminated the moment the logonscript itself is ended. I prefere this behavior, this way users or processes are not able to terminate or disturb the logon scripted processes.

        If there is a problem to run a logonscript successfully because of this behavior, then disabling synchronously run of the logonscript could be one of the options you can try (or, disabling synchronously run of the startupscripts IF it would have been a startup script).
        (refer also this post: Re: Batch file failing on some machines, not others)

        What I personally like to do first, is to see if can solve the problem by making some changes to the script.
        If for example the script lauches an app or an other script (whatever process started from within the logonscript), make it run in a way the logonscript will wait for its return.

        e.g (batch)
        from within a logonscript,
        - start a cmd or bat file like-> Call batch.cmd
        - start an exe file like-> Start "" /wait "prog.exe"
        - start a hta file like-> Start "" /w mshta.exe "app.hta"
        - start vbs files like-> Start "" /w cscript.exe //nologo "script.vbs"
        - or vbs files like-> Start "" /w wscript.exe //nologo "script.vbs"

        A sample how you can start Bginfo.exe
        Code:
        Start ""/w "\\%userDNSdomain%\netlogon\Utils\Bginfo.exe" /silent /all /timer:0
        :: Sample from, forums.petri.com/showthread.php?t=27552
        .
        Last edited by Rems; 24th December 2008, 10:23.

        This posting is provided "AS IS" with no warranties, and confers no rights.

        __________________

        ** Remember to give credit where credit's due **
        and leave Reputation Points for meaningful posts

        Comment


        • #5
          Re: WSH logon script only runs if there's user interaction

          So I should be able to use BGInfo with scripts running synchronously? I'll have to do some testing to see if I can get things going. I've already seen people hitting the x on the logon script window. I'd like to run the script just through WSH, but I've heard that doesn't work very well.

          Comment


          • #6
            Re: WSH logon script only runs if there's user interaction

            Originally posted by spectre240sx View Post
            I've already seen people hitting the x on the logon script window. I'd like to run the script just through WSH, but I've heard that doesn't work very well.
            Run logonscripts hidden (gpo configuration). Then users can only stopt the logonscript via taskmanager or by using a command/script.

            Yes it is possible to use a vbs also, same thing. When Running executables from within any kind of logonscript, always keep the configured script behavior in the GPO and the configured security zones on the computer in mind.

            Besite running a executable fom within the logonscript you could also use a logonscript (or startupscript) to add the exe file path to the runonce key in HKCU (or HKLM) in the register on the computer.


            \Rems

            This posting is provided "AS IS" with no warranties, and confers no rights.

            __________________

            ** Remember to give credit where credit's due **
            and leave Reputation Points for meaningful posts

            Comment


            • #7
              Re: WSH logon script only runs if there's user interaction

              Thank you for all the info. I'll be working on implementing a lot of these suggestions soon.

              Comment


              • #8
                Re: WSH logon script only runs if there's user interaction

                I know this is a bit of an old thread, but I just wanted to post a followup.

                I've switched over to running scripts synchronously again and using "start /wait..." just didn't work for me. I ended up putting "ping -n 1 -w 1000 127.0.0.1 > nul" at the end of the script to force it to wait for 1 second (kludgy, but it works). This fixed the problem of the script not waiting. Secondly, I took advantage of the runonce key as Rems suggested. It's working very well.

                Comment

                Working...
                X