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:

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.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.
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
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.
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

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"
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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!
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2003

From novice to tech pro — start learning today.