Announcement

Collapse
No announcement yet.

VB Login script intermittently does not run

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

  • VB Login script intermittently does not run

    Hi All,

    I have a really frustrating problem with vb logon scripts.

    To give you some background information on the environment in question

    In the past month i have replaced both the domain controllers in HQ with servers which are more than adequate in terms of specification imo,

    The OS for both DC's is Server 2003 Enterprise R2

    FSMO roles are split between the 2 dc's

    The scripts were written using scriptlogic, the scripts themselves do not have any errors, if they are ran manually they straight away map all required network drives. In addition to this frustratingly the script will run sometimes, no issues whatsoever for anyone.
    But as often as it does run it does not.

    I had put this down to the previous dc's being antequated and very slow, therefore they weren't capable of processing the logon requests from all the clients, there would be circa 180 - 200 pc's in hq.

    I have tried to do as much troubleshooting as i can but now i am at a loss as to what else to try.

    For any users who had this issue a lot the first thing that was attempted was to add a registry key to the following location:

    HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon

    Insert dword

    RunLoginScriptSync

    Value set to 1

    This has had minimal impact on resolving the fault.

    Next I replaced the dc's for hq

    As a trial i changed how the login script is applied to the user.
    (I picked on the IT dept as guinea pigs)

    This has previously been defined on an individual basis under the profile tab of their account in AD
    eg user joe bloggs would use ITLoginscript.vbs

    This is now defined in group policy for the whole o.u

    However this has had no impact on how frequently the script runs successfully.

    The next change I tried was to enable the group policy setting -
    Always wait for the network at startup and logon
    Found at the following location:
    Computer Configuration
    Administrative Templates
    System
    Logon

    However this has had no impact on how frequently the script runs successfully, but users now have a longer logon time due to having to wait for the logon screen to appear.

    I have ran DCDiag and Replmon on the dc's but no errors have been reported.

    I have completely ran out of ideas on this and I would really appreciate any advice / suggestions as to how to resolve this.

    Many thanks

    Jonathan

  • #2
    Re: VB Login script intermittently does not run

    Some questions relevant to the issue,
    - Where did you configured the user logon script to run, was is 1)in a GPO or 2)at the useraccount properties in AD or 3)one of the Auto startup locations. And,,
    - is your vbscript lauched directly from there or through an other script/batch or command line.
    - Is your vbscript launching any programs/scripts/batches in separate processes?
    - Is the script stored on a trusted path on the network (where is it stored?).
    - What OS is on the clients?
    - can we have a look at the script.


    Note: the entry "RunLoginScriptSync" in the registry can also be set by GPO at Computer configuration or at User configuration.
    (When enabled it directs the system to wait for user logon scripts to finish running or timed-out before it starts the Windows Explorer interface program and creates the desktop. Any processes lauched from with in this script will be killed when the windows explorer interface starts).

    The policy "Always wait for the network at startup and logon" is required when you run logon/startup scripts via GPO. Yes it can more or less slow down the startup/logon process. This infact confirms that it was needed to enable this policy as a logonscript cannot be found on the network when there not yet a network connection has been established.


    \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: VB Login script intermittently does not run

      Originally posted by Rems View Post
      Some questions relevant to the issue,
      - Where did you configured the user logon script to run, was is 1)in a GPO or 2)at the useraccount properties in AD or 3)one of the Auto startup locations.
      And,,
      - is your vbscript lauched directly from there or through an other script/batch or command line.
      - Is your vbscript launching any programs/scripts/batches in separate processes?
      - Is the script stored on a trusted path on the network (where is it stored?).
      - What OS is on the clients?
      - can we have a look at the script.


      Note: the entry "RunLoginScriptSync" in the registry can also be set by GPO at Computer configuration or at User configuration.
      (When enabled it directs the system to wait for user logon scripts to finish running or timed-out before it starts the Windows Explorer interface program and creates the desktop. Any processes lauched from with in this script will be killed when the windows explorer interface starts).

      The policy "Always wait for the network at startup and logon" is required when you run logon/startup scripts via GPO. Yes it can more or less slow down the startup/logon process. This infact confirms that it was needed to enable this policy as a logonscript cannot be found on the network when there not yet a network connection has been established.


      \Rems
      Thanks rems

      In response to your questions:

      1.
      For the group of test users it is now configured in the gpo at the following location
      User Configuration -> Windows Settings -> Scripts (Logon / Logoff)

      2. Script is defined in the logon setting

      3. No other script is used to call this script although part of the script calls another vb script which maps the users home folder.

      4. The script is stored in

      \domain\netlogon
      5. The clients are 99% windows xp sp3 there are a few windows 7 pcs in the department

      6. I have attached a txt file of the login script

      Many thanks

      Jonathan
      Attached Files

      Comment


      • #4
        Re: VB Login script intermittently does not run

        Are some of the users (incl the test users) member of the Local Admin group on their computer? Is User Acount Control enabled on the Win 7 clients?


        By the first look,

        1) It is a fact that your script does not run well when UAC enabled on the Windows 7 clients.
        When UAC is enabled on any clients in your network, the script needs to be modified.
        i.e. Regedit /s can no longer be used in a logonscript! Instead use REG.exe IMPORT and, you should provide the complete network path to the reg file in the script wrapped beteen double quotes. Secondly, when UAC is enabled there are drive and printer mapping issues when the user is a member of the local admins group. The logonscript should determine if it currently is running in elevated mode. If that is the case, the script should create a task using the task scheduler that wil take care of the mappings. The task is excuted next to the logon process so it will run under the user's limited user token and mappings will be there and available to the user. (In your environment the script also needs to determine first whether the OS is >= Vista or is =< XP/2003).

        2) It might be nessesary to disable RunLoginScriptSync because the logon script is starting an other script what could not have been completed yet when the actual logon script ends.
        Or better, why don't you configure homefolder.vbs as second logonscript in the GPO and have the command line removed from the first vbscript.

        3) Use \\<domain fqdn>\sysvol\<domain fqdn>\Scripts as the path for the script.
        for testing: try adding \\<domain fqdn>\* to the list in the local intranet zone on each computer.
        4) Try also this:
        - comment-out all On Error Resume next lines in the script
        - then go to the GPO, User Configuration -> Windows Settings -> Scripts (Logon / Logoff)

        Logonscript: CMD.exe
        Parameters: /C >"%temp%\logonscript1.log" 2>&1 cscript.exe //NoLogo "\\<domain fqdn>\sysvol\<domain fqdn>\Scripts\scriptname.vbs"

        - update policies on the client then, relogon.
        Open the log file a few minutes after logon.


        I will have a closer look at the script probably this evening.


        \Rems
        Last edited by Rems; 22nd November 2010, 15:07.

        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: VB Login script intermittently does not run

          rems
          i split the login script out

          removed the reference to homefolder.vbs and ITPrint.vbs

          added these scripts to the group policy setting individually.

          i also enabled the group policy setting
          Computer Config -> system -> scripts -> run logon scripts synchronously

          still some people didn't get their scripts this morning
          Last edited by jmcg; 23rd November 2010, 15:45. Reason: i can't spell

          Comment


          • #6
            Re: VB Login script intermittently does not run

            Are those users suffering this logonscripts problem, having this every time they logon or, randomly? Is it always the same set of users.

            Are some of all users member of the local administator group?

            / Does always the same set of computers having this problem? Constantly or random? Are computers thats having this issue only windows 7 computers?

            Do you make use of loopback proceccing policies?

            Is the "Always wait for the network at computer startup and logon" policy still enabled.
            chenk the registry on one of the failing computers:
            HKEY_LOCAL_MACHINE\Software \Policies\Microsoft\Windows NT \CurrentVersion\Winlogon\
            Value name: SyncForegroundPolicy = 1 ("REG_DWORD")

            And,
            Are the logon scripts correctly added to the users part of the registry?:
            - HKEY_CURRENT_USER\Software\Policies\Microsoft\Wind ows\System\ Scripts\Logon
            The policy write it there and the USERINIT process will read it there and launch the script.

            Then,
            The Resultant Set of Policy information can tell you if the script ran by reporting the time the script ran. If the script has never executed successfully, you will see either a time of “0” or a blank entry in the Last Executed column. Note, a gpupdate /force will reset that value.
            For possible errors running the script look in application_events for records with as the sourse: USERINIT


            \Rems
            Last edited by Rems; 24th November 2010, 11:19.

            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

            Working...
            X