Mapped Network Drives on login for Specific Users Only

S

Stanbridge

Hi all,

I'm fairly new to Windows Server 2003. At present, I have setup a script so
that all users will have various network drives mapped when they login. The
script lives in: C:\WINDOWS\SYSVOL\sysvol\nyoffice.local\scripts\login.bat

The contents of login.bat are as follows:
net use t: \\server\transfers
net use z: \\server\city
net use k: \\server\PIM4US

In addition to what this script currently does, I would also like it so that
for a few specific users, they get an additional network drive on login.

Can someone show me how to do this?

Many thanks!


Stanbridge
 
P

Pegasus \(MVP\)

Stanbridge said:
Hi all,

I'm fairly new to Windows Server 2003. At present, I have setup a script
so
that all users will have various network drives mapped when they login.
The
script lives in:
C:\WINDOWS\SYSVOL\sysvol\nyoffice.local\scripts\login.bat

The contents of login.bat are as follows:
net use t: \\server\transfers
net use z: \\server\city
net use k: \\server\PIM4US

In addition to what this script currently does, I would also like it so
that
for a few specific users, they get an additional network drive on login.

Can someone show me how to do this?

Many thanks!


Stanbridge

There are several ways of doing this. Here is one way:
Presumably your users have a personal share called \\server\%UserName%. If
so then you can create a hidden folder \\server\%UserName%\netlogon. Into
that folder you can place the batch file netlogin.bat, but only if you wish.
It would contain personal network mappings. Your master netlogin batch file
must look like this:
net use t: \\server\transfers
net use z: \\server\city
net use k: \\server\PIM4US
if exist \\server\%UserName%\netlogon\netlogin.bat call
\\server\%UserName%\netlogon\netlogin.bat
 
S

Stanbridge

Hi Pegasus,

Thanks for the speedy reply! Unfortunately the users do not have their own
shared folders on the Server. The drives that you see mapped in Login.bat
below are just shared folders on the server's root directory (C:\).

Is there somewhere special I would need to setup shared folders for each
user (each with a netlogon folder as below)? If so, how do I name these
folders? Or rather, how will Windows know which folder belongs to which user?

Otherwise, is there a way I can setup a Group in "Active Directory Users and
Computers" and then somehow assign a specific login.bat or netlogin.bat to
that?

Apologies for the obvious newbieness! Thanks again mate!


Stanbridge
 
P

Pegasus \(MVP\)

Sooner or later you will have to create personal shares for your users. They
will demand it . . .

The principle I used can be equally applied by creating a common share to
which all users have access. Let's call it "Common". Your master login batch
file would now look like so:
net use t: \\server\transfers
net use z: \\server\city
net use k: \\server\PIM4US
if exist \\server\Common\%UserName%.bat call \\server\Common\%UserName%.bat

Again I would hide the various batch files. I would also make the Common
share read-only.
 
S

Stanbridge

Cool. So just to confirm, by naming the .bat login script file after the
user's login name (the username they type to log into Windows) Windows will
know to activate this script for that particular user on login?

Or using your other method with personal shares, naming the %UserName%
folder in \\server\%UserName%\netlogon\netlogin.bat after the user's window
login - Windows will be able to match the foldername with the user here too?

Cheers
 
S

Stanbridge

Hi again!

I tried the following without any luck. In this example, the I tested with
staffer windows login "bwood" (minus the double-quotes).

1) On the \\server I created shared (full access to everyone) folder named
"salesteam". This will be the folder that only the few individual users need
access to.
1) On the \\server I created a folder named "bwood". This is the folder for
the first user's login script. If this works I would also setup folders of
the same nature containing the special login script for the other few users.
2) In this folder I created a folder called "netlogon".
3) In this folder I created a file called netlogin.bat.
4) In netlogin.bat I added "net use m: \\server\mynewshare"

5) In my master login batch file (\\server\netlogon) I updated the login.bat
script to appear as follows:
net use t: \\server\transfers
net use z: \\server\city
net use k: \\server\PIM4US
if exist \\server\bwood\netlogon\netlogin.bat call
\\server\bwood\netlogon\netlogin.bat

When I log out of the server and log into bwood's PC I don't see the new
drive.

I also tried actually adding % symbols to either side of the bwood folder
and in the script. This didn't work either.

Could it be something to do with the bwood subfolder being named "netlogon"
and the script being named "netlogin.bat" (filenames for the folder and
script therein don't match).

Can you see what I might have done wrong? Any help is much appreciated!

Thanks again!


Stanbridge
 
P

Pegasus \(MVP\)

There appears to be some confusion about folders and shares. You tend to use
the terms interchangeably - yet they are completely different things. You
write, for example:
On the \\server I created a folder named "bwood".
and also:
if exist \\server\bwood\netlogon\netlogin.bat call
but you never write anything about creating a "share" called "bwood".

To create a share, two things are necessary:
1. You must have a folder to which the share points. On your server its
perhaps something like d:\shares\bwood.
2. You must create a share that points to this folder. There are several
ways of doing it. Here is a Console command:
net share bwood=d:\shares\bwood{Enter}

Testing your concept by logging on and waiting for the login script to do
the right thing is wasteful. It would be much faster to open a Command
Prompt on one of the workstations and type a few commands, e.g. like so:
dir \\server\bwood{Enter}
dir \\server\bwood\netlogon{Enter}
type \\server\bwood\netlogon\netlogin.bat{Enter}
\\server\bwood\netlogon\netlogin.bat{Enter}

These commands will execute instantly and they will immediately tell you
what's wrong.
 
S

Stanbridge

Ah yes, you're right, sorry about that!
Got it working for staffer's individual shares now.

Thanks very much for all of your help Pegasus!!!

Very much appreciated!!!
 
O

OS

Pegasus,
I am hoping that you could help me.
I am looking for a way to create a script or something to map a personal drive for all the users in my windows 2008 AD.
Currently i have about 200 users and they need a personal mapped drive on our file server .
I want that when the users login it would automatically create a mapped drive and create a folder with their first initial and last name in a particular directory directory on our server and provie them with read and write access.
Currently when the users log-in they would type their first initial and last name and then their password and they would login.

Can this be done.
how do i go about doing it.

file server info

PLS-P-FIL01\e$\Personal Drives\%username%



Pegasus \(MVP\) wrote:

Re: Mapped Network Drives on login for Specific Users Only
08-Dec-08


There are several ways of doing this. Here is one way
Presumably your users have a personal share called \\server\%UserName%. If
so then you can create a hidden folder \\server\%UserName%\netlogon. Into
that folder you can place the batch file netlogin.bat, but only if you wish.
It would contain personal network mappings. Your master netlogin batch file
must look like this
net use t: \\server\transfer
net use z: \\server\cit
net use k: \\server\PIM4U
if exist \\server\%UserName%\netlogon\netlogin.bat call
\\server\%UserName%\netlogon\netlogin.bat

Previous Posts In This Thread:

Mapped Network Drives on login for Specific Users Only
Hi all

I'm fairly new to Windows Server 2003. At present, I have setup a script so
that all users will have various network drives mapped when they login. The
script lives in: C:\WINDOWS\SYSVOL\sysvol\nyoffice.local\scripts\login.ba

The contents of login.bat are as follows
net use t: \\server\transfer
net use z: \\server\cit
net use k: \\server\PIM4U

In addition to what this script currently does, I would also like it so that
for a few specific users, they get an additional network drive on login

Can someone show me how to do this

Many thanks

Stanbridge

Re: Mapped Network Drives on login for Specific Users Only

There are several ways of doing this. Here is one way
Presumably your users have a personal share called \\server\%UserName%. If
so then you can create a hidden folder \\server\%UserName%\netlogon. Into
that folder you can place the batch file netlogin.bat, but only if you wish.
It would contain personal network mappings. Your master netlogin batch file
must look like this
net use t: \\server\transfer
net use z: \\server\cit
net use k: \\server\PIM4U
if exist \\server\%UserName%\netlogon\netlogin.bat call
\\server\%UserName%\netlogon\netlogin.bat

Hi Pegasus,Thanks for the speedy reply!
Hi Pegasus

Thanks for the speedy reply! Unfortunately the users do not have their own
shared folders on the Server. The drives that you see mapped in Login.bat
below are just shared folders on the server's root directory (C:\)

Is there somewhere special I would need to setup shared folders for each
user (each with a netlogon folder as below)? If so, how do I name these
folders? Or rather, how will Windows know which folder belongs to which user

Otherwise, is there a way I can setup a Group in "Active Directory Users and
Computers" and then somehow assign a specific login.bat or netlogin.bat to
that

Apologies for the obvious newbieness! Thanks again mate

Stanbridg

:

Sooner or later you will have to create personal shares for your users.
Sooner or later you will have to create personal shares for your users. They
will demand it . . .

The principle I used can be equally applied by creating a common share to
which all users have access. Let's call it "Common". Your master login batch
file would now look like so:
net use t: \\server\transfers
net use z: \\server\city
net use k: \\server\PIM4US
if exist \\server\Common\%UserName%.bat call \\server\Common\%UserName%.bat

Again I would hide the various batch files. I would also make the Common
share read-only.



Cool. So just to confirm, by naming the .
Cool. So just to confirm, by naming the .bat login script file after the
user's login name (the username they type to log into Windows) Windows will
know to activate this script for that particular user on login?

Or using your other method with personal shares, naming the %UserName%
folder in \\server\%UserName%\netlogon\netlogin.bat after the user's window
login - Windows will be able to match the foldername with the user here too?

Cheers


:

Hi again!
Hi again!

I tried the following without any luck. In this example, the I tested with
staffer windows login "bwood" (minus the double-quotes).

1) On the \\server I created shared (full access to everyone) folder named
"salesteam". This will be the folder that only the few individual users need
access to.
1) On the \\server I created a folder named "bwood". This is the folder for
the first user's login script. If this works I would also setup folders of
the same nature containing the special login script for the other few users.
2) In this folder I created a folder called "netlogon".
3) In this folder I created a file called netlogin.bat.
4) In netlogin.bat I added "net use m: \\server\mynewshare"

5) In my master login batch file (\\server\netlogon) I updated the login.bat
script to appear as follows:
net use t: \\server\transfers
net use z: \\server\city
net use k: \\server\PIM4US
if exist \\server\bwood\netlogon\netlogin.bat call
\\server\bwood\netlogon\netlogin.bat

When I log out of the server and log into bwood's PC I don't see the new
drive.

I also tried actually adding % symbols to either side of the bwood folder
and in the script. This didn't work either.

Could it be something to do with the bwood subfolder being named "netlogon"
and the script being named "netlogin.bat" (filenames for the folder and
script therein don't match).

Can you see what I might have done wrong? Any help is much appreciated!

Thanks again!


Stanbridge



:

There appears to be some confusion about folders and shares.
There appears to be some confusion about folders and shares. You tend to use
the terms interchangeably - yet they are completely different things. You
write, for example:
On the \\server I created a folder named "bwood".
and also:
if exist \\server\bwood\netlogon\netlogin.bat call
but you never write anything about creating a "share" called "bwood".

To create a share, two things are necessary:
1. You must have a folder to which the share points. On your server its
perhaps something like d:\shares\bwood.
2. You must create a share that points to this folder. There are several
ways of doing it. Here is a Console command:
net share bwood=d:\shares\bwood{Enter}

Testing your concept by logging on and waiting for the login script to do
the right thing is wasteful. It would be much faster to open a Command
Prompt on one of the workstations and type a few commands, e.g. like so:
dir \\server\bwood{Enter}
dir \\server\bwood\netlogon{Enter}
type \\server\bwood\netlogon\netlogin.bat{Enter}
\\server\bwood\netlogon\netlogin.bat{Enter}

These commands will execute instantly and they will immediately tell you
what's wrong.



Ah yes, you're right, sorry about that!
Ah yes, you are right, sorry about that!
Got it working for staffer's individual shares now.

Thanks very much for all of your help Pegasus!!!

Very much appreciated!!!





:

Re: Mapped Network Drives on login for Specific Users Only
Thanks for the feedback.


Submitted via EggHeadCafe - Software Developer Portal of Choice
Distributed Data Grids - Share Objects Between Windows Service and ASP.NET
http://www.eggheadcafe.com/tutorial...b7a-1bb00e33db07/distributed-data-grids-.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top