Logon Script generating Error

This is more a minor inconvenience than an actual problem, but it's one I'd like to solve.

I have a logon script that is applied to every user who logs in.  It is kept on the DC\NETLOGON share and is simply called logon.bat.  Every time it runs it generates the following error:

'\\SERVER\NETLOGON'
CMD.EXE was started with the above path as the current directory.  UNC paths are not supported.  Defaulting to Windows directory.

It then goes on and runs the script as normal.

How do I stop this error?

If I run the script from the command line (caliing \\server\netlogon\logon.bat) it runs fine with no errors.

LVL 1
Ziggie013Asked:
Who is Participating?
 
brtweirCommented:
This is not a problem - You will this occur whenever a script runs from a UNC as opposed to a drive letter. JEBeckham is correct in his statement, however if this is  a Windows 2000 / 2003 environemnt you need to put the script in the %dcname%\sysvol\fqdn\scripts directory and then the script will run just fine without specifying the whole UNC path.
0
 
Jeff BeckhamEngineerCommented:
You're calling something inside the .bat that doesn't like where it's being called from.  You can try prepending a "%0\..\" to the command or map a drive letter and then run whatever it is you're trying to do inside the logon script.
0
 
Ziggie013Author Commented:
I am simply running net commands.  When I add the %0 to the front of the first line, I get the same error, and then get "The directory name is invalid"  
Here are the first few lines of the logon script:

@net time /set /yes
@if exist I:\_Masters\ (
@echo I Drive already mapped
) ELSE (
@net use i: /d
net use i: \\server\share
)
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
Jeff BeckhamEngineerCommented:
Are you specifying "\\SERVER\NETLOGON\logon.bat" on the logon script for the user?  If so, all you should need to supply is the file name.  Windows assumes the netlogon share from the authenticating domain controller.
0
 
Ziggie013Author Commented:
I was specifying the full UNC to the logon script.  I removed it and the logon script doesn't run at all now.  No errors popup on the local machine.  In Event Viewer I get the following:

"Could not execute the following script logon.bat. The system cannot find the file specified"
0
 
Ziggie013Author Commented:
Ah ha, that did it!

Like i said, it was just annoying, and it delayed the logon script about 15 seconds.  So now I don't have that problem!
0
 
Jeff BeckhamEngineerCommented:
Do you have more than 1 domain controller in your domain?  If so, your script might not be replicating to the other DCs, one of which might be authenticating you when you logon to the domain.  The logon script needs to be either manually copied to the NETLOGON share of all of your DCs or replication needs to be given time to replicate the script to the remaining DCs.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.