Solved

Login Batch Script not updating on login?

Posted on 2006-11-14
6
305 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
Comment Utility
.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
Comment Utility
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
Comment Utility
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:leont
Comment Utility
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
Comment Utility
Sorry Dragon-it, page refreshed after i accepted sirbounty's answer.  Thanks for everyones help.
0
 
LVL 43

Expert Comment

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

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

by Batuhan Cetin Within the dynamic life of an IT administrator, we hold many information in our minds like user names, passwords, IDs, phone numbers, incomes, service tags, bills and the order from our wives to buy milk when coming back to home.…
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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now