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: 482
  • Last Modified:

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
0
sXmont1j6
Asked:
sXmont1j6
  • 24
  • 13
  • 9
1 Solution
 
Chris MillardCommented:
it should read:-

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

you have the quotes in the wrong place.
0
 
sXmont1j6Author Commented:
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
 
pony10usCommented:
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 free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
sXmont1j6Author Commented:
Can one explain why I add the persistent just for the V drive mapping?
0
 
pony10usCommented:
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
 
sXmont1j6Author Commented:
Ok, I won't remove that setting.  Thanks guys, I will do this.
0
 
sXmont1j6Author Commented:
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
 
pony10usCommented:
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
 
sXmont1j6Author Commented:
But why is it successful when ran manually?
0
 
pony10usCommented:
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
 
Chris MillardCommented:
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
 
sXmont1j6Author Commented:
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
 
Chris MillardCommented:
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
 
pony10usCommented:
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
 
Chris MillardCommented:
can you comment out the ipconfig /flushdns line then to see if it is that causing issue?
0
 
Chris MillardCommented:
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
 
Chris MillardCommented:
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
 
sXmont1j6Author Commented:
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
 
Chris MillardCommented:
Make sure that the user can access the script - try and run it from the command line for that user
0
 
sXmont1j6Author Commented:
ok, I did that and it ran properly.
0
 
sXmont1j6Author Commented:
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
 
Chris MillardCommented:
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
 
sXmont1j6Author Commented:
IT doesn't look the command window is even showing for some users.
0
 
sXmont1j6Author Commented:
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
 
pony10usCommented:
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
 
sXmont1j6Author Commented:
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
 
pony10usCommented:
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
 
sXmont1j6Author Commented:
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
 
sXmont1j6Author Commented:
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
 
pony10usCommented:
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
 
pony10usCommented:
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
 
sXmont1j6Author Commented:
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
 
sXmont1j6Author Commented:
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
 
sXmont1j6Author Commented:
Why would a script work on a Terminal server for a user but on the users' workstation.
0
 
sXmont1j6Author Commented:
but not on the users' workstation.  I feel like there is a network issue related here...
0
 
pony10usCommented:
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
 
sXmont1j6Author Commented:
Checked this previously.  It does.
0
 
pony10usCommented:
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
 
Chris MillardCommented:
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
 
sXmont1j6Author Commented:
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
 
sXmont1j6Author Commented:
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
 
pony10usCommented:
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
 
sXmont1j6Author Commented:
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
 
pony10usCommented:
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
 
sXmont1j6Author Commented:
This problem has been resolved by re-creating the share.
0
 
sXmont1j6Author Commented:
None of the above answers assisted.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

  • 24
  • 13
  • 9
Tackle projects and never again get stuck behind a technical roadblock.
Join Now