Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 321
  • Last Modified:

Login Batch Script not updating on login?

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
leont
Asked:
leont
  • 3
  • 2
1 Solution
 
sirbountyCommented:
.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
 
leontAuthor Commented:
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
 
Steve KnightIT ConsultancyCommented:
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
leontAuthor Commented:
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
 
leontAuthor Commented:
Sorry Dragon-it, page refreshed after i accepted sirbounty's answer.  Thanks for everyones help.
0
 
Steve KnightIT ConsultancyCommented:
Just bad timing ... if I'd have refreshed I'd have seen your comment!
Steve
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now