Link to home
Start Free TrialLog in
Avatar of sXmont1j6
sXmont1j6Flag for United States of America

asked on

Why is my login script not working properly?

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
Avatar of Chris Millard
Chris Millard
Flag of United Kingdom of Great Britain and Northern Ireland image

it should read:-

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

you have the quotes in the wrong place.
Avatar of sXmont1j6

ASKER

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?
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
Can one explain why I add the persistent just for the V drive mapping?
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.
Ok, I won't remove that setting.  Thanks guys, I will do this.
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?
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.
But why is it successful when ran manually?
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
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
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.
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...
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"
can you comment out the ipconfig /flushdns line then to see if it is that causing issue?
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
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
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?
Make sure that the user can access the script - try and run it from the command line for that user
ok, I did that and it ran properly.
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.
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.
IT doesn't look the command window is even showing for some users.
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.
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
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...
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

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???  ??:
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?
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.
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.
What would cause a "delay" in the time that I make an update to a login script and the have that user log in?
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?
Why would a script work on a Terminal server for a user but on the users' workstation.
but not on the users' workstation.  I feel like there is a network issue related here...
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.
Checked this previously.  It does.
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?
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 ?
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...)
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...
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.
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?
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?
ASKER CERTIFIED SOLUTION
Avatar of sXmont1j6
sXmont1j6
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
None of the above answers assisted.