Question

Active Directory User Login Scripts Not Working

Asked by: Exia

I am running into a problem getting my Active Directory user login scripts to run properly.

I have made a bunch of different login scripts for my different users.  Our users each need specific things, and different from each other, so I'm using a login script for each instead of making a bunch of group policy objects that only work for 1-2 users each.

I have created my .bat files and placed them into the netlogon share on the server.  I have been able to run these batch files from their target users' computers without problem.  If I put a shortcut to the batch into the users' Startup folder - it will run perfectly when they login.  So, in short, the login script itself works properly.

However, when I go to the Active Directory and select a user -> properties -> profile, I put the full path of the .bat file into the box that says "Login script:" and I click Apply and OK.  I will log the user off of their PC and have them log back in - only to see that no login batch is running.

The "Profile path:" box above the "Login script:" box is empty, but I am under the impression that it only has to do with roaming profiles.  This shouldn't be affecting my login script should it?

Any ideas as to why this isn't working?

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-09-28 at 12:09:18ID24767932
Tags

Activie Directory

,

Login Script

,

Logon Script

,

Roaming Profile

Topics

Active Directory

,

Windows Server 2008

,

SBS Small Business Server

Participating Experts
3
Points
500
Comments
21

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Help! Login scripts and Roaming Profiles
    Please help me in creating login scripts and procedure for creating roaming profiles in a active directory server with file locations. Thanx a lot
  2. Problem mapping z: with login script due to netlogon share
    I have a script that tries to map z:\ to a network share. It works fine on Win2000. But on a Win98 machine it says that z: is already mapped to \\server\netlogon do I want to change it. If I do it doesn't map the drive and explorere.exe crashes. Can I force the netlogon shar...
  3. Login Script in Batch
    I'm new to the IT world--I'm only 17 years old, working for a information forensics company--and I'm new to many of the jobs that a systems administrator must do. Like scripting. We run Active Directory on our main server, and I need a script to map users to drives based o...
  4. netlogon
    I have a small office network with xp computers and 2000 computers. One server running Windows 2003 Server. On one of my computers when I log on I get a command window that says cmd.exe was started with the above path as the current directory. UNC paths are not supported. ...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: _BirkoffPosted on 2009-09-28 at 12:16:23ID: 25442339

the logon scripts should be placed in the netlogon folder of your domain controller.
in the logon script field only enter the name of the script you want to use.

for example "logon_user1.cmd"
the path should NOT be included

 

by: ExiaPosted on 2009-09-28 at 12:33:04ID: 25442489

The login scripts are already in the netlogon folder on my domain controller.

I did change the "Logon script:" field to only have the script itself instead of the full path.

This still did not work.  

Another question:  My login scripts that I made are using a .bat file type, but your example shows a .cmd file type.  Does this matter?

 

by: Mike_CourtneyPosted on 2009-09-28 at 12:37:31ID: 25442533

bat files should be fine but you can rename to .cmd if you prefer.
Do you have any virus scanners running - some of these have options to stop .bat files runnig from certain locations at startup.
also make sure you've spelt the name of the script correctly
not put any slashes in (are the scripts in the root of the netlogon share)
Also confirm the permissions on the bat file

 

by: ExiaPosted on 2009-09-29 at 07:48:37ID: 25449628

I have the script I am trying to run in the root of the netlogon share.  I've tried running as both a .bat and .cmd file, but have had little luck with either.  It now appears that the script DOES try to run upon login, but it just hangs on the first command in the script and does nothing.

If I try manually running the same script from the same location, it works perfectly.  If I manually put a shortcut to the script (still in the netlogon share) in my startup folder, it will run upon login and have no problems either.

So the script works, and the user/computer clearly have access to it.  It's just when I try to let it run automatically using the Active Directory Logon Script option, it hangs on an open cmd window - with the text of the first line of the script displayed, but not working.  I've let it sit for like 10 minutes to make sure it wasn't just slow, but nothing changed.

I've tried changing the first line of the script to a few different things, but each time it still hangs.  I've tried a net time command to start, I've dried to map a drive to start, but nothing changed no matter what I tried to start with.

I've set the permissions of the .bat file for "everyone" to have read and run access.

I'm running out of ideas - anyone have any suggestions?

 

by: _BirkoffPosted on 2009-09-29 at 08:17:59ID: 25450011

does a simple echo script also hang on the first line?

try something like the script below:

@echo off
echo this is the first command
pause
echo this is the second command
pause
echo this is the third command
pause
exit

                                              
1:
2:
3:
4:
5:
6:
7:
8:

Select allOpen in new window

 

by: ExiaPosted on 2009-09-29 at 09:15:14ID: 25450594

I made a script called echo.bat and it does not appear to be hanging.  The cmd window was there and said:

this is the first command
Press any key to continue . . .

I could press a key and then it went to second, then third, then it exited.  So it appears to be working as it should.  Perhaps the hanging has something to do with my script?

This is basically what my script looks like.  I'm trying to map some drives and force a time sync (we run a weird time system, don't ask).  Again, this script works perfectly if run manually, or if placed in the startup folder (both times running from the netlogon folder).  Do I need to change something in my script maybe?

net use P: \\server\folder1 password /user:"username"
net use T: \\server\folder2 password /user:"username"
net use R: \\server\folder3 password /user:"username"
net time \\server /set /yes
                                              
1:
2:
3:
4:

Select allOpen in new window

 

by: _BirkoffPosted on 2009-09-29 at 09:20:08ID: 25450644

do you shares contain any spaces? if so you should use:
net use P: "\\server\folder 1"

does your system require to logon to the shares with a specific username and password?
if so, remove the quotes:
net use P: \\server\folder1 password /user:username

also do you have any group policies enabled?

 

by: ExiaPosted on 2009-09-29 at 09:31:12ID: 25450754

The shares don't contain spaces.  I made sure of that to avoid potential problems.  The shares are all going to require specific user names and passwords, as certain people are allowed access to certain files.

I'll try without the quotes (although the script works with the quotes - if run manually or in the startup menu).

Also, I do have group policies enabled.  This is actually something that concerns me.  If I go to a client and open and command prompt and type "gpupdate /force" I get the following:

Refreshing Policy. . .

User Policy Refresh has completed.
Computer Policy Refresh has completed.

Certain User policies are enabled that can only run during logon.

OK to logoff. (Y/N)

My gut is telling me that something in one of our group policies is doing something during logon, and it's fighting with my login script or preventing it from running, or something...

Is this a possibility?  I'll go take a look through my group policies and see if I can find anything that looks out of place, or something unnecessarily running during login.  Really not sure what it could be though.

 

by: _BirkoffPosted on 2009-09-29 at 09:33:23ID: 25450783

i think i know what's causing your problem. let me check on my group policies. brb

 

by: _BirkoffPosted on 2009-09-29 at 09:36:39ID: 25450813

do you have "run logon scripts synchronously" enabled? (user configuration > administrative templates > system > scripts)
if so, see what happens if you disable this setting

 

by: ExiaPosted on 2009-09-29 at 10:43:51ID: 25451408

I looked in every group policy object I could find and "Run logon scripts synchronously" was not enabled in any of them.

 

by: Mike_CourtneyPosted on 2009-09-29 at 11:09:12ID: 25451654

given the additional info especially as it seems to start running and hangs I would suggest its more likely to be the 'wait for network at startup' ppolicy option
http://support.microsoft.com/kb/304970

 

by: ExiaPosted on 2009-09-29 at 11:13:11ID: 25451697

The KB article linked is assuming that I have the "Run logon scripts synchronously" policy enabled, which I do not.

I will try enabling both "Run logon scripts synchronously" and "Always wait for the network at computer startup and logon" and see what happens.  I'll post back here shortly with my results.

 

by: ExiaPosted on 2009-09-29 at 11:39:42ID: 25451927

Tried enabling both group policy settings listed in my last post, and the script still hangs at the same spot.

 

by: Mike_CourtneyPosted on 2009-09-29 at 11:54:25ID: 25452077

this may seem banal but make sure you give them at least 2 reboots to give the policies a chance to apply.

do you need to have user credentials in the script can you not rely on ntlm and use ntfs permissions, I assume you're in a domain.

have you been able to pin down which command it hangs on

 

by: ExiaPosted on 2009-09-29 at 12:01:41ID: 25452151

I'm doing 2 reboots each time - just to be safe.  8-)

It hangs on whichever command is at the top.  I've tried moving commands around and still no luck.

If a net use X: \\server\blah is at the top, that's what it hangs on.
If a net time \\server /set /yes is at the top, then it will hang there.

I actually just tried a different script, which ONLY has a net time command, and it still hangs.  No mapping, no users, and still no luck.

We're deploying some new PCs so I snagged one early in the process and made sure I didn't have any antivirus on it yet - just in case the AV was preventing the script from running properly.  Still no luck on the AV-less no-firewall PC (PC is in the domain, all updates, logging in with same user I've been testing these scripts on).

 

by: Mike_CourtneyPosted on 2009-09-29 at 12:53:57ID: 25452739

Have you tried using a different user account.
I'm tempted to say we should increase userenv logging to verbose but I'm not sure it will catch the logon scripts

Can you confirm what the run logon scripts synchronously was originally set to (was it not configured) and did you check the computer and user configuration

 

by: Mike_CourtneyPosted on 2009-09-29 at 13:02:12ID: 25452841

Have you had any userinit errors in the event logs

 

by: alanhardistyPosted on 2009-10-15 at 00:57:24ID: 25578245

Can you remove the /user:"username" after each net use command as this is causing the problem I think and is not necessary.

Alan

 

by: alanhardistyPosted on 2009-10-15 at 01:00:52ID: 25578273

You also need to lose the password so that yout net use command should look like this:

Net use T: \\server\share

Nothing else is needed.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...