Solved

Login Batch Script not updating on login?

Posted on 2006-11-14
6
308 Views
Last Modified: 2008-03-03
Hi everyone, currently we have several batchfiles that take care of mapping net work drives.  For sometime these have been working with no problems, however we have come to change the mapping on one of the drives on boot, so have included the command to delete the current mapping before recreating the mapping to the new location.  This is not working as i would have expected.

When the user logs in the old mapping is still pointing to the wrong location.  I have tried to run the mapping manually on the desktop and this works (even when i run it through the Netlogon share on the DC(s), however it does not on boot and login,  I did try removing the profile path in the users profile and add it as a Logon GP in AD but this did not work either.  If i delete the local user profile on the desktop , this obviously works, but i don't really want to do that?  Any ideas appreciated.  (i have not tried to change the .bat login file into a .cmd file, would that be advisable before adding it to a GP in AD?

a sample of the exact script is below (its about as simple as it gets)

net use n: /delete /yes
net use n: \\bws-app01\home\staff

(note. the previous instance is referencing \\curriculum02\home\staff, as N: and want to replace this with the above.

Thanks
Leon
 
0
Comment
Question by:leont
  • 3
  • 2
6 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 500 total points
ID: 17937640
.bat=.cmd - realistically synonomous - they're run the same.

You're certain that the logon script is being run?

For the above, I don't see right off what would cause it to fail.
You might try reversing the process
and then some troubleshooting steps:

  echo y|net use n: /del
  if exist n:\nul echo N drive still connected && pause



0
 

Author Comment

by:leont
ID: 17937993
Hi Sirbounty, the batch is definately running, as it says it completed the mapping when you step through, however you go into windows explorer and it is still referencing the old drive mapping of \\curriculum01\whatever whatever and not the new \\BWS-FAP01\whatever whatever, does that make sense?
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 17938028
I was going to suggest a log file to check what is going on, i.e

net use n: /delete /yes >%userprofile%\netuse.log 2>&1
net use n: \\bws-app01\home\staff >> %userprofile%\netuse.log 2>>&1

to redirect output of commands and errors to \ log file called netuse.log in the user's profile.  Assuming you can't see it running for some reason (e.g. login scripts are displaying as hidden) that might point out why.

It could also be they have a persistent mapping so the script removes it then they login and it puts it back.  I always do:

net use /persistent:no

at the top of login scripts to stop this behaviour.
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 

Author Comment

by:leont
ID: 17938261
Hi Sirbounty, apparently you were right the profile was trying to call a batch file from a strange source and would not run the correct one (even though the profile/login script directory in AD was pointing to the correct one?), as i say weird but it but your comments pointed me in he right area, many thanks, enjoy

leon
0
 

Author Comment

by:leont
ID: 17938293
Sorry Dragon-it, page refreshed after i accepted sirbounty's answer.  Thanks for everyones help.
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 17938495
Just bad timing ... if I'd have refreshed I'd have seen your comment!
Steve
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface Having the need * to contact many different companies with different infrastructures * do remote maintenance in their network required us to implement a more flexible routing solution. As RAS, PPTP, L2TP and VPN Client connections are no…
Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question