[Samba] drive mapping for one user

Charles Marcus CMarcus at Media-Brokers.com
Fri Dec 4 07:14:07 MST 2009


On 12/4/2009, Hubert Choma (hubert.ch at wp.pl) wrote:
> I would like to map a drive letter  for one user via netlogon script. 
> How can I do it ?
> The user is in geo group and I would like to map only for one user not 
> group.

I would just add either of the lines to your existing script:

:: call username specific .bat file
if %username% == user call \\SERVER\netlogon\user.bat

The above obviously requires the user.bat file to reside in the NETLOGON
share and contain whetever user specific stuff you need.

or if all you need to do is map just one drive:

:: map username drive
if %username% == user NET USE X: \\SERVER\SHARE

You can also map drives for people in a group using the ISMEMBER check.
This requires the ISMEMBER.EXE (freely available online) executable to
be in the NETLOGON share:

:: map drive for GroupName users
\\SERVER\netlogon\ismember "Domain\GroupName"
if errorlevel 1 net use x: \\SERVER\PATH\TO\DIR /persistent:no

> echo off
> C:
> CD \
> NET TIME \\SERWER /SET /YES
> NET USE * /D /YES
> REM NET USE H: /HOME
> NET USE R: \\SERWER\RASTRY$
> NET USE S: \\SERWER\EVID$
> NET USE T: \\SERWER\OSRODEK$
> NET USE U: \\SERWER\TMP$
> NET USE X: \\SERWER\OSNOWA$
> NET USE Y: \\SERWER\GEO1$
> NET USE Z: \\SERWER\GEO$
> NET USE W: \\SERWER\SKANY
> regedit /s \\serwer\netlogon\placesbargeo.reg




-- 

Best regards,

Charles Marcus
I.T. Director
Media Brokers International, Inc.
678.514.6200 x224
678.514.6299 fax


More information about the samba mailing list