Login script asks for username and password

Hi,
 I have a server running Server 2008. There are - let's say - 5 shares on the server.  Some users needs access to all shares, others only access to 3 shares and another group of users needs access to 4 shares (this is just an example).

I have then made a simple logon.bat file so I can map the drives with NET USE command.

Now here is the problem. All users are running the same script at startup. This means that some users also tries to map drives they don't hae access to. So when they run the script - it stalls and ask for username/password.

Can I somehow add a command after each NET USE - so the script just continues - and just skips the mapping the user do not have access to?

P.S. If I run the script manually - and when it asks for username/password - I can just hit "Enter" and the script continues (only adding the drives the user have access to).

Thanks in advance.
LVL 4
Henrik Rosager PedersenIT ManagerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Daniel HelgenbergerCommented:
Deploying shares with login scripts is rather outdated. If you use a group policy preference, you can target the shares by users and groups.

If this is not possible, change the script to examine the running context. For instance:
IF %username% Mary net use h: \\server\share
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Raks84Commented:
Hi hpdenmark,

I would suggest the same as helge000, its better we create group policy and assign the specific user names and groups to access the required share drives. Its tension free.

You can create Group policies in your server manager, you will have to add the Group Policy feature under Features in server manager, which is a step by step wizard. Later on, expand Group Policy and add a forest and link it to your existing DNS and AD. from there you can automate almost any requirement for your client, you have to select the required Group policy and add your users or groups to it. Once done, restart the client machine or perform a gpupdate in the client machine command prompt with administrator rights or from run box, right click cmd prompt and select run as administrator. If the gpupdate cmd doesn't work try gpupdate /force command either in run or command prompt. That should do the trick.

Remember we have to create separate Group policy's for the same process we want to execute, in your case for every different group or users to access specific share drives, separate GP's for share drive access has to created/enabled linking to the desired share drive and adding required users or groups.

Hope this helps.

Regards,
RK.
0
Pramod UbheCommented:
If you want to stick with your existing plan, try configuring 'List folder Contents' permissions  for 'Everyone' and make sure you have set correct share permissions as well.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2008

From novice to tech pro — start learning today.