[Samba] different logon scripts and mappings for individual users

Charles Marcus CMarcus at Media-Brokers.com
Tue Jun 17 18:00:00 GMT 2008

On 6/17/2008, Leandro Tracchia (ltracchia at gmail.com) wrote:
> i'm not sure how to create different logon scripts for different
> users. right now i have one logon script called 'logon.bat' that maps
> all users to a server share and syncs the time with the server. i need
> to be able to map different users to different server shares. not all
> users should be mapped to all server shares. these should be automatic
> mappings.
> for example:
> user1 should only be automatically mapped to music/ share when he logs in.
> user2 should only be automatically mapped to photos /share when he logs in.

Here's my Global Logon script:


echo off
net time \\mytimeserver /set /y

if exist C:\WINDOWS\system32\ISMEMBER.EXE goto map-all
if exist y: net use y: /del
net use y: \\mypdc\installers /persistent:no
copy y:\Free\ISMEMBER.EXE c:\WINDOWS\system32\
copy y:\Free\OSVER.EXE c:\WINDOWS\system32\

call \\mypdc\netlogon\unmap-all.bat
call \\mypdc\netlogon\map-all.bat

if %username% == user1 net use f: \\myotherserver\Share1 /persistent:no

ISMEMBER "MyDomain\Group1"
if errorlevel 1 net use j: \\mypdc\Share1 /persistent:no

ISMEMBER "MyDomain\Group2"
if errorlevel 1 call \\mypdc\netlogon\Group2.bat

ISMEMBER "MyDomain\Group3"
if errorlevel 1 net use q: \\myotherserver\Share2 /persistent:no

ISMEMBER "MyDomain\Group4"
if errorlevel 1 net use s: \\mypdc\Share2 /persistent:no



Then each Group and/or user can have their own - or not.

map-all maps drives that are common to everyone
unmap-all unmaps *all* mapped drives

ISMEMBER.EXE and OSVER.EXE (which I don't use anymore) are available 
free online from microsoft.


Best regards,


More information about the samba mailing list