none
Logon script not working

    Question

  • Hi

    I have a .bat script that creates network drives, copies word templates, copies Normal.dotm, copies desktop wallpaper to local machine, and other things.  When I add this to group policy (User Configuration\Windows Settings\Scripts\Logon), it does not work. 

    AD is on Windows 2003. When I manually run this script on my local Win 7 machine, the script works as expected.  The script used to work but as far as I can see, nothing has changed.  All other Groupy Policy settings are still working.   GPResult shows the script. 

    I forgot to mention that the script is stored somewhere on the network  (\\servername\scripts)

    Any idea why this script isn't working?


    Marc Collins www.QGate.co.uk


    • Edited by MWacUK Monday, July 30, 2012 2:41 PM Additional info
    Monday, July 30, 2012 1:32 PM

Answers

  • It turns out that I wasn't waiting long enough to see if the changes were being made.  After my machine had finished rebooting, it took around 7-8 minutes for the changes to be applied.  This means that the original issue could of been fixed at any point between yesterday and now.  I can only assume that the rebooting the server fix it as all my original settings are still inplace.

    Marc Collins www.QGate.co.uk

    • Marked as answer by MWacUK Tuesday, July 31, 2012 12:21 PM
    • Unmarked as answer by MWacUK Tuesday, July 31, 2012 12:21 PM
    • Marked as answer by MWacUK Friday, August 03, 2012 7:01 AM
    Tuesday, July 31, 2012 12:21 PM

All replies

  • Hello Marc,

    First thing when I hear Script + Network:

    Did you activate "Always wait for the network.."

    http://support.microsoft.com/kb/305293

    on my local Win 7 machine

    The next thing would be, is UAC turned on?
    Is there a change when UAC is off?

    BTW:
    All of the thing you mention, could be done with Group Policy Preferences in a smarter way...

    have a look here


    MVP Group Policy - Mythen, Insiderinfos und Troubleshooting zum Thema GPOs: Let's go, use GPO!


    Monday, July 30, 2012 6:00 PM
  • Hi,

    Please note that the logon script should be placed in the below path:

    \\domain.com\sysvol\domain.com\policies\{GUID}\user\scripts\logon\

    When you expand User Configuration\Policies\Windows Settings\Scripts\Logon, double click it, and then click Add button and then click Browser to find your logon script there.

    In addition for that, please also refer to the below link:

    Login script not mapping drives for users

    http://social.technet.microsoft.com/Forums/en/winserverTS/thread/fd7d5a7a-01cf-454e-b30c-011746a8eec1

    Regards,

     

    TechNet Subscriber Support

    If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.


    Yan Li

    TechNet Community Support


    Tuesday, July 31, 2012 5:11 AM
    Moderator
  • Thanks for the input.

    However your suggestions have not worked so I am thinking that there is something more sinister going on.

    1. "Always wait for the network.." - I have just tried this and the script does not run.
    2. is UAC turned on? - We disbale this religiously
    3. Group Policy Preferences... - This looks pretty interesting however I will need to fully test first
    4. ...\sysvol\domain.com\policies\{GUID}... - I have tried this already and the results are the same.  Script doesn't run
    5. Login script not mapping drives for users - The script does not work even if I remove the network drive mappings

    The things that concern me is that this has worked in the past.  Also, I have been testing with gpupdate /force so the network connection shouldn't matter as it is already in place.


    Marc Collins www.QGate.co.uk

    Tuesday, July 31, 2012 9:47 AM
  • I am starting to make progress with this now.

    At the top of the script I have added a command that creates a new folder on C: (MD "Newfolder").  After restarting my machine, the folder was there confirming that the script is running.  I am guessing that it is timing out at a certain point in the script causing it to not run the remaining section.

    I should now be able to find the exact point where it is failing and the modify it accordingly.


    Marc Collins www.QGate.co.uk

    Tuesday, July 31, 2012 11:02 AM
  • It turns out that I wasn't waiting long enough to see if the changes were being made.  After my machine had finished rebooting, it took around 7-8 minutes for the changes to be applied.  This means that the original issue could of been fixed at any point between yesterday and now.  I can only assume that the rebooting the server fix it as all my original settings are still inplace.

    Marc Collins www.QGate.co.uk

    • Marked as answer by MWacUK Tuesday, July 31, 2012 12:21 PM
    • Unmarked as answer by MWacUK Tuesday, July 31, 2012 12:21 PM
    • Marked as answer by MWacUK Friday, August 03, 2012 7:01 AM
    Tuesday, July 31, 2012 12:21 PM
  • right click copy script/batch file
    Scripts > Logon >
    add
    browser.

    paste file there

    simply point your file and apply ok.


    Regards Suman B. Singh

    Tuesday, July 31, 2012 5:07 PM
  • My script is stored on a network drive (//ServerName/Scripts).  I have not copied to the location mentioned above.  Doing this would make it more difficult to manage the scripts as I am not the only one who makes changes.


    Marc Collins www.QGate.co.uk

    Wednesday, August 01, 2012 8:33 AM
  • Hi,

    If we use ADUC to set the logon script for domain users, then we could put the script on a share folder.

    But for logon script group policy, if your script works fine when you put it on a share folder instead of the default place. We could do this, but by default, we suggest you put it in the default place, this way the script could be achieved when the GPO applied.

    Regards

    TechNet Subscriber Support

    If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.


    Yan Li

    TechNet Community Support

    Thursday, August 02, 2012 8:03 AM
    Moderator
  • If your using this as a logon script through group policy the default place would make things much easier. I recently encountered an issue similar to this where I couldnt get a simple batch file to work. It would work whenever I ran it from the local desktop, but not when I relied on Group Policy.

    For testing purposes -- Try placing the file in the default location for logon scripts mentioned above.

    THEN

    Make sure the users you are trying to apply this to are part of the OU that is linked to the Group Policy.

    Also I just the other day had to unmap and map a drive the the letter S: which was being used previously.  I was unsuccessful using a script I knew should work. So I found that through User Config --> Preferences --> Windows Settings --> Drive Maps      You can very easily Replace, Update, Create and Delete a Network Drive.

    Thursday, August 02, 2012 7:02 PM