?
Solved

Why is my login script not working properly?

Posted on 2013-12-06
46
Medium Priority
?
480 Views
Last Modified: 2014-01-08
Ok, below is my logon script and file1 is a new 2012 file server.  All of the drives map properly except the V drive, see below.  It is not for every user, but everyday I have about 10-15 users, all different complain that the V drive is not there.  All we do, it run the script manually, and it maps.  This is definitely not rocket science, but I am missing something...  Please assist.  




echo off

ipconfig /flushdns

net use K: \\file1\formswp
net use L: \\file1\dictation
net use M: \\server\users\%username%
net use N: \\file1\pins
net use O: \\file1\stips
net use P: \\file1\briefs
net use R: \\file1\indexes
net use U: \\file1\urlings
net use V: \\file1"\scanned documents" /PERSISTENT:yes
net use X: \\server\installs


exit
0
Comment
Question by:sXmont1j6
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 24
  • 13
  • 9
46 Comments
 
LVL 17

Expert Comment

by:Chris Millard
ID: 39701138
it should read:-

net use V: "\\file1\scanned documents" /persistent:yes

you have the quotes in the wrong place.
0
 

Author Comment

by:sXmont1j6
ID: 39701156
I had that the other day, but will try again because I added the persistent:yes.  

Can you explain to me why I need to add the persistent:yes?
0
 
LVL 26

Expert Comment

by:pony10us
ID: 39701157
roybridge is correct.

Something else you may wish to think about is deleting any existing mappings at the start of the script

net use * /delete /y
0
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 

Author Comment

by:sXmont1j6
ID: 39701168
Can one explain why I add the persistent just for the V drive mapping?
0
 
LVL 26

Expert Comment

by:pony10us
ID: 39701203
Adding the persistent is so that the drive will be there after a reboot.  If the computer is taken off the network then the drive will still be mapped but will show as disconnected.  When it is placed back on the network it will once again be able to access the files without having to map it again. For example, a laptop that is taken home at night.

This also "locks" that drive letter to that location unless/until deleted.
0
 

Author Comment

by:sXmont1j6
ID: 39701215
Ok, I won't remove that setting.  Thanks guys, I will do this.
0
 

Author Comment

by:sXmont1j6
ID: 39701261
Alright, I am again at a loss, see steps I took.  Below is the script that runs at logon:

echo off

ipconfig /flushdns

net use * /delete /y
net use K: \\file1\formswp
net use L: \\file1\dictation
net use M: \\server\users\%username%
net use N: \\file1\pins
net use O: \\file1\stips
net use P: \\file1\briefs
net use R: \\file1\indexes
net use U: \\file1\urlings
net use V: "\\file1\scanned documents" /PERSISTENT:yes
net use X: \\server\installs


exit

- Rebooted system while all of the drives are mapped and after login, all drives were mapped successfully EXCEPT for the dreaded V drive mapping.  I then manually ran the script and the V drive appeared.

- Disconnected all of the network drive mappings manually, rebooted system and only the \\server shared mapped, M & X, all of the \\file1 shares didn't map.  Manually ran the script and the \\file1 mappings all appeared.

Strange....  What you guys think?
0
 
LVL 26

Expert Comment

by:pony10us
ID: 39701275
Sounds like it can't find \\file1 when it is trying to map the drives.

Start by REMing out the echo off so that you see each line execute with any associated error messages.
0
 

Author Comment

by:sXmont1j6
ID: 39701281
But why is it successful when ran manually?
0
 
LVL 26

Expert Comment

by:pony10us
ID: 39701299
Because you would run it manually at a later time than the login. This would permit it time to "see" the network.

On one of the machines that is not mapping try enabling Linked connections through a registry setting (REMEMBER USUAL CAUTION ABOUT WORKING IN REGISTRY)

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
 "EnableLinkedConnections"=dword:00000001
0
 
LVL 17

Expert Comment

by:Chris Millard
ID: 39701341
since you are going to run this at each logon, I would remove the /persistent:yes option from the V: drive mapping.

Also, it *may* be the space in the "scanned documents" share name causing issue, so can you try changing the share name to "scanned_documents" and then change the script line to:-

net use V: \\file1\scanned_documents
0
 

Author Comment

by:sXmont1j6
ID: 39701348
I understand the spacing, but I have a concern with changing the share.   It is due to the way our Case Management System was setup.  I believe it looks for that share...  (Note:  I did not set it up...lol)

But I am going to remove the persistent: yes and test.
0
 
LVL 17

Expert Comment

by:Chris Millard
ID: 39701359
You can have more than one share name on a folder, so you can create an additional share called "scanned_documents" for the same folder...
0
 
LVL 26

Expert Comment

by:pony10us
ID: 39701366
Good thought but it still comes down to the timing of the login script and the ability to see the server/shares based on your comment: "...all of the \\file1 shares didn't map.  Manually ran the script and the \\file1 mappings all appeared"
0
 
LVL 17

Expert Comment

by:Chris Millard
ID: 39701370
can you comment out the ipconfig /flushdns line then to see if it is that causing issue?
0
 
LVL 17

Expert Comment

by:Chris Millard
ID: 39701374
Alternatively, and although a bit crude you could add the following line to the top of the script (after the @echo off):-

ping >NUL: file1

that will ping file1 4 times which may be long enough for it to respond
0
 
LVL 17

Expert Comment

by:Chris Millard
ID: 39701380
Oh and of course, you could always try mapping using the IP address of file1 instead i.e.

net use V: \\ip.ip.ip.ip\scanned_documents
0
 

Author Comment

by:sXmont1j6
ID: 39701608
Ok, So I changed the script to the following:

echo off

ping file1

net use * /delete /y
net use K: \\file1\formswp
net use L: \\file1\dictation
net use M: \\pond-server\users\%username%
net use N: \\file1\pins
net use O: \\file1\stips
net use P: \\file1\briefs
net use R: \\file1\indexes
net use U: \\file1\urlings
net use V: "\\file1\scanned documents"
net use X: \\pond-server\installs

ipconfig /flushdns


end


I am testing it and it appears to be working just fine.  What would be an issue if the script just doesn't run for a specific user even though in AD I have the script associated with that user?
0
 
LVL 17

Expert Comment

by:Chris Millard
ID: 39701615
Make sure that the user can access the script - try and run it from the command line for that user
0
 

Author Comment

by:sXmont1j6
ID: 39701640
ok, I did that and it ran properly.
0
 

Author Comment

by:sXmont1j6
ID: 39701738
Some users are even seeing the script run...  FRUSTRATING!!!!!! sorry for the caps, that was me losing it over something that normally is not this difficult.
0
 
LVL 17

Expert Comment

by:Chris Millard
ID: 39701750
I'm not surprised at people seeing it run - I administer quite a few domains for various companies, and those with SBS running login scripts normally see them - after all, it's just running in a command window.
0
 

Author Comment

by:sXmont1j6
ID: 39701759
IT doesn't look the command window is even showing for some users.
0
 

Author Comment

by:sXmont1j6
ID: 39701780
I can't understand this a little bit, just changed the script to:
echo off

ping file1

net use * /delete /y
net use K: \\file1\formswp
net use L: \\file1\dictation
net use M: \\pond-server\users\%username%
net use N: \\file1\pins
net use O: \\file1\stips
net use P: \\file1\briefs
net use R: \\file1\indexes
net use U: \\file1\urlings
net use V: \\file1\scanned_documents
net use X: \\pond-server\installs

ipconfig /flushdns


end

And every drive appears except the V drive... But when run manually, it works.
0
 
LVL 26

Expert Comment

by:pony10us
ID: 39701784
We have noticed that the login box usually doesn't show for Windows 7 workstations. When it does show it is usually due to very slow network connectivity (could be caused by congestion)

We always saw it in Windows XP
0
 

Author Comment

by:sXmont1j6
ID: 39701791
I saw that as well, but why is it just this V drive that is not mapping...  I can't for the life of me understand why it maps manually...
0
 
LVL 26

Expert Comment

by:pony10us
ID: 39701799
Try running this and look at the three sections in c:\drives.txt

echo off

ping file1

echo. Before drive unmap  >> c:\drives.txt
net use >> c:\drives.txt

net use * /delete /y 

echo. After drive unmap >> c:\drives.txt
net use >> c:\drives.txt

net use K: \\file1\formswp
net use L: \\file1\dictation
net use M: \\pond-server\users\%username%
net use N: \\file1\pins
net use O: \\file1\stips
net use P: \\file1\briefs
net use R: \\file1\indexes
net use U: \\file1\urlings
net use V: \\file1\scanned_documents
net use X: \\pond-server\installs

echo. After new map >> c:\drives.txt
net use >> c:\drives.txt
 
ipconfig /flushdns


end

Open in new window

0
 

Author Comment

by:sXmont1j6
ID: 39701805
So, I logged in with my credentials to my RDS server and the script ran and mapped.  But it is not running and\or mapping on my local machine... HUH???  ??:
0
 

Author Comment

by:sXmont1j6
ID: 39701838
OK, so I created a new script with your commands, and it worked properly.  Attached is the drives.txt.  

Why did this work and the script that I created not working?
0
 
LVL 26

Expert Comment

by:pony10us
ID: 39701859
first - I think you forgot to attach the file.

Second - I have no idea.  All I did was add the commands to create the drives.txt file so you could see what actually happened at each step. I didn't change anything that you had. In fact, I copied your posted script to notepad and added my 6 lines and then posted it.
0
 
LVL 26

Expert Comment

by:pony10us
ID: 39701865
The only thing that I can think is that there is still a timing issue because adding those lines would increase the run time by 1-5 mS each maybe.
0
 

Author Comment

by:sXmont1j6
ID: 39701899
What would cause a "delay" in the time that I make an update to a login script and the have that user log in?
0
 

Author Comment

by:sXmont1j6
ID: 39701903
Wow, that sounded awful.  I updated my script and tried to have a user login but the script didn't run the updated version, what would cause that?
0
 

Author Comment

by:sXmont1j6
ID: 39701907
Why would a script work on a Terminal server for a user but on the users' workstation.
0
 

Author Comment

by:sXmont1j6
ID: 39701912
but not on the users' workstation.  I feel like there is a network issue related here...
0
 
LVL 26

Expert Comment

by:pony10us
ID: 39701917
On the computer (not the TS) click start and type:

\\%logonserver%\sysvol\HAYDEN.LOCAL\scripts

and see if you have access to the script from that location.
0
 

Author Comment

by:sXmont1j6
ID: 39701920
Checked this previously.  It does.
0
 
LVL 26

Expert Comment

by:pony10us
ID: 39701956
Let me list out what I think we have so far.

script at login:
1. Script runs on a TS
2. Script does not run on a workstation (the whole thing or just the one map?)
         (same user both locations)

Is it possible that there is a permission issue for the user on that workstation?  Have you had the same user try on a different workstation and a different user try on that workstation?
0
 
LVL 17

Expert Comment

by:Chris Millard
ID: 39702159
OK - let's get a bit more information on the whole network setup.

file1 is a new Server 2012 (R2 ?)
what OS is pond-server?

Is pond-server the main domain controller?

Is file1 a member server or another domain controller on the same domain?

Are there other servers on the domain?

Has the script EVER worked properly, or has this started since adding file1 ?
0
 

Author Comment

by:sXmont1j6
ID: 39722213
I am so sorry, that I did not reply to this...  but I am still having issues with ONLY one drive mapping... But to answer your questions...

file1 is a new Server 2012 (R2 ?) - Server 2012 DataCenter
what OS is pond-server? Server 2008 R2

Is pond-server the main domain controller? YES

Is file1 a member server or another domain controller on the same domain? member server

Are there other servers on the domain? yes

Has the script EVER worked properly, or has this started since adding file1 ? Script always worked when the shared were on pond-server and a different DC.  I consolidated and created one file server and for the most part, the only part of the script that is not working is "fully" is:
net use V: \\file1\scanned_documents.

I am at a loss, I am wondering if it is an issue with 2008\2012...  (BTW, I hate server 2012, just wanted to throw that out there...)
0
 

Author Comment

by:sXmont1j6
ID: 39722237
Hmmm... I think I just found an issue... pinged domain.com from my workstation came up with pond-server's IP address.  Pinged domain.com from file1 and it came back with a different DC's IP address...
0
 
LVL 26

Expert Comment

by:pony10us
ID: 39724155
That really shouldn't matter.  For example, I just pinged domain.com on a TS and it returned the IP of a non-DC.  Did the same from the workstation side (where I have the TS session running) and it returned the IP of the main DC.
0
 

Author Comment

by:sXmont1j6
ID: 39724166
I am just really confused why my V drive is not mapping.  The issue is so inconsistent.  But effects about 18-10 users daily.  The only variable is that the V drive is a VERY large share folder.  But, that should not matter at all, correct?
0
 
LVL 26

Expert Comment

by:pony10us
ID: 39725316
When you say VERY large I am going to step back and say that ours are probably no where near the size of yours.  We maintain right around 40GB on all our shares except one. That one is a SAMBA share that is used for passing data between Windows and AIX and doesn't really store any data.

It does sound like it may be related to the size of the share. Especially since it appears that the other mappings to the same server appear to be functional (at least most of the time?)

Can you try and map somewhere further down in the structure and see if the issue persists?
0
 

Accepted Solution

by:
sXmont1j6 earned 0 total points
ID: 39754258
This problem has been resolved by re-creating the share.
0
 

Author Closing Comment

by:sXmont1j6
ID: 39764676
None of the above answers assisted.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Trying to figure out group policy inheritance and which settings apply where can be a chore.  Here's a very simple summary I've written which might help.  Keep in mind, this is just a high-level conceptual overview where I try to avoid getting bogge…
Know what services you can and cannot, should and should not combine on your server.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

649 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