map drives based on group membership / AD description path

Discussion in 'Windows Small Business Server' started by Jack, Sep 28, 2005.

  1. Jack

    Jack Guest

    I once saw a pretty slick way to map drives based on group membership. I
    believe the logon script used the ifmember cmd to determine what groups user
    belonged to. It would then map the drive according to what was in the
    description field for the group in AD - ie ["*:\\servername\share"] would map
    user to next available drive. However the same description line without
    wildcard ["m:\\servername\share"] would map to letter m. This seemed to work
    very well. If I didnt want user to have access, i would remove user - file
    permissions wouldnt permit user getting in. And if user had permission - a
    drive would automatically be mapped.
    I am wanting to incorporate something very similar. Any samples, links would
    be greatly appreciated.

    Thanks,
    Jack
     
    Jack, Sep 28, 2005
    #1
    1. Advertisements

  2. Jack

    A. Feiner Guest

    I use KIX32 for my batch file, it looks something like this:
    IF InGroup("Acctmgr")
    $homeserver="DC1"
    USE P: \\teacup\maindir\reports
    USE H: \\teacup\maindir\eaglePro
    Use R: \\teacup\maindir\acctg
    ENDIF
    You can go further and
    IF InGroup("Accounting")or @userid = "lspencer"
    $homeserver="DC1"
    USE P: \\teacup\maindir\reports
    USE H: \\teacup\maindir\eaglePro
    Use R: \\teacup\maindir\acctg
    redirectoutput ("r:\logon.txt",0)
    If RedirectOutput ("r:\logon.txt")=0
    ?@wksta",in,"+@date","+@userid","+@TIME (that's to capture login time
    for reporting purposes)
     
    A. Feiner, Sep 28, 2005
    #2
    1. Advertisements

  3. Jack

    A. Feiner Guest

    The IfMember works with conditions, here is how to test

    IfMember "Domain Admins"
    If ERRORLEVEL 1 exit
    rem Notice that the syntax here is the opposite to normal in that
    rem %ERRORLEVEL% = 1 = Success
    rem with most other NT commands %ERRORLEVEL% = 1 = Fail/Error
    net send %computername% Boo!

    Or
    IfMember "Accounting"
    If ERRORLEVEL 1
    net use B: \\server\share
     
    A. Feiner, Sep 28, 2005
    #3
  4. Jack

    Jack Guest

    Amnon,

    Thanks for your reply. What I am looking for is script that will
    automatically map drive based on 1) users in group 2) what is listed in
    global group description field(ie [*:\\servername\share] or to specify
    particular drive [G:\\servername\share]

    That way I will not have script each time a drive has either moved or drive
    letter is different.

    Any ideas?


     
    Jack, Oct 5, 2005
    #4
  5. Jack

    A. Feiner Guest

    Jack

    Then you can use either one they are both suitable. Look at:
    http://www.kixtart.org/

    --
    Amnon Feiner
    http://www.woodcontour.com
    Solid Wood & Stone PC Peripherals.
     
    A. Feiner, Oct 5, 2005
    #5
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.