Announcement

Collapse
No announcement yet.

AD Group login script

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • AD Group login script

    Trying to setup a login script that maps drives based on what groups the user is member of.

    This is what i have so far but does not seem to work. Any help is appricateed

    Cheers

    Code:
    rem check for resource utility
    IF NOT EXIST %windir%\IFMEMBER.EXE copy \\wilcox-serv\netlogon\ifmember.exe %windir%
    
    :accounts
    \\wilcox-serv\netlogon\ifmember "Accounts"
    if not errorlevel 1 goto sales
    net use H: /delete
    net use H: \\wilcox-serv\Accounts
    
    :sales
    \\wilcox-serv\netlogon\ifmember "Sales"
    if not errorlevel 1 goto common
    net use Q: /delete
    net use Q: \\wilcox-serv\SALES
    
    :common
    \\wilcox-serv\netlogon\ifmember "Common"
    if not errorlevel 1 goto pegasus
    net use U: /delete
    net use U: \\wilcox-serv\Common
    
    :pegasus
    \\wilcox-serv\netlogon\ifmember "Pegasus"
    if not errorlevel 1 goto engineering
    net use O: /delete
    net use O: \\wilcox-serv\Pegasus
    
    :engineering
    \\wilcox-serv\netlogon\ifmember "Engineering"
    if not errorlevel 1 goto productinfo
    net use T: /delete
    net use T: \\wilcox-serv\Engineering
    
    :productinfo
    \\wilcox-serv\netlogon\ifmember "ProductInfo"
    if not errorlevel 1 goto prodrive
    net use S: /delete
    net use S: \\wilcox-serv\Production
    
    :ProDrive
    \\wilcox-serv\netlogon\ifmember "prodrive"
    if not errorlevel 1 goto Done
    net use P: /delete
    net use P: \\wilcox-serv\photodrive
    
    :Done

  • #2
    Re: AD Group login script

    First you copy the script from the server to the local machine so try running it from there.

    Second i think the sysntax for your script looks wrong.

    Try something like this

    Code:
    :hrgrp
    ifmember hrgrp
    if not errorlevel 1 goto secgrp
    net use u: \\server1\secshare$

    Comment


    • #3
      Re: AD Group login script

      Assume that users dont have write permission to save ifmember to %windir%.
      Run it from cmd and you'll see where's problem ...

      If your servers are running w2k3 do not forget domain name!

      btw more elegant way to map drives:

      ifmember "mydomain\group" || net use x: \\server\share
      Last edited by Petr Bohac; 22nd September 2006, 12:59.

      Comment


      • #4
        Re: AD Group login script

        Originally posted by Petr Bohac
        btw more elegant way to map drives:

        ifmember "mydomain\group" || net use x: \\server\share
        So could i just use what you have specified above for each of the groups i have on the server?

        Cheers

        Dave

        Comment


        • #5
          Re: AD Group login script

          yep, it will do the job

          you can hide result from ifmember if loginscript is visible to user:

          ifmember "mydomain\group">nul || net use x: \\server\share

          also ifmember /list lists you all groups which is current user member

          Comment


          • #6
            Re: AD Group login script

            Originally posted by Petr Bohac

            ifmember "mydomain\group" || net use x: \\server\share
            Hi,

            i am complete novice when it comes to scripts. here is my problem..

            i am trying to add users to the group they belong to. i did a test to make sure it works. this is what i did..

            1. created a group named "SageUsers"
            2. add a user in this group named "test"
            3.domain name is "ItNetworkSupport"
            4.create a folder named "common" which will be used as a share and enabled sharing on the folder. Do i need to share the folder?

            This is the script exactly: Is there anything missing i.e any variables if so what?

            ifmember "itnetworksupport\SageUsers" || net use j: \\pdcserver\common

            this is the error i get when i execute the script, see attachment
            please help...

            Thanks in Advance!!
            Attached Files

            Comment


            • #7
              Re: AD Group login script

              Zaf,

              Please do NOT hijack another users thread.

              Please start your own.

              Reported.

              And to answer your question. You have an error within your script. Once you create a new thread outlining your problem and ost your script you MAY get some help.
              Last edited by wullieb1; 1st October 2006, 18:55.

              Comment


              • #8
                Re: AD Group login script

                Originally posted by wullieb1
                Zaf,

                Please do NOT hijack another users thread.

                Please start your own.

                Reported.

                And to answer your question. You have an error within your script. Once you create a new thread outlining your problem and ost your script you MAY get some help.
                i wasnt trying to hijack any thread, this thread and the user had similar problem so i thought i will include my problem in this thread preventing duplication of threads..

                sorry i dint know that i had to start a complete new thread for similar/identical problem.

                thanks

                Comment

                Working...
                X