Announcement

Collapse
No announcement yet.

Login Script to Map Users Personal Drive

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

  • Login Script to Map Users Personal Drive

    Hello to all the experts. Just wish to know that is the below login script workable?

    ECHO ON
    SET PATH I: \\Server\USERS\%USERNAME%

    My intention is to create a personal drive of every users, i have in their pc when they reboot the pc.
    I believe the \%USERNAME% will be tied to the login ID of that particular pc. eg.

    My login id of my PC is vampiel. So my this logon script will be:

    ECHO ON
    SET PATH I: \\S2003\USERS\vampiel

    Is this correct?

    Please adivce me

  • #2
    Re: Login Script to Map Users Personal Drive

    No, using SET PATH is not correct. Please lookup the help for NET USE instead by typing NET USE /?

    What SET PATH does is it creates a long environment variable which is a series of paths that cause the operating system to look in those locations when running a program (if the program's path is not explicitly specified). So for example, if C:\MyApps is part of your system's PATH environment, you could open a command prompt and run an executable that resides in the C:\MyApps folder without having to tell the perating system whereabouts that executable lives. the OS just 'knows' where to look because C:\MyApps is on the "PATH". So SET PATH does not map drive letters.

    Contrast that with NET USE which will map a resource to a letter, and it can even map printers (for example to LPT1: ) as well as shared folders (to drive letters). So what you need is
    Code:
    NET USE I: \\Server\USERS\%USERNAME%
    You may also like to consider using NET USE I: /DELETE first, so as to get rid of any unwanted I: drive letters that may have existed before, otherwise an old I: mapping will break things.
    Best wishes,
    PaulH.
    MCP:Server 2003; MCITP:Server 2008; MCTS: SBS2008

    Comment


    • #3
      Re: Login Script to Map Users Personal Drive

      further to Paul's excellent post, I would put a short (1 sec or so) delay between the /delete and the /use. In my experience the /delete takes a little while to complete and the /use bombs if it hasn't done.


      Tom
      For my own and your protection, I do not provide support by private message under any circumstances. All such messages will be deleted and ignored.

      Anything you say will be misquoted and used against you

      Comment


      • #4
        Re: Login Script to Map Users Personal Drive

        Thanks paul for your excellent explaination.... I got it.

        so i assume the full logon script command will be

        Echo On
        NET USE I: \\S2003\USERS\%USERNAME%

        S2003 -> Server name
        USERS -> Folder name

        M i correct to say that?

        Sorry i am quite a Scripting Idiot.

        Anyway i really appreciate your help.

        Comment


        • #5
          Re: Login Script to Map Users Personal Drive

          Yes, you got it - also don't forget that the folders all have to exist!

          Also, consider the net use I: /delete line and Tom's advice on the delay too. Just suggestions - good luck! Oh, and test it plenty
          Last edited by biggles77; 31st March 2007, 14:41. Reason: Put space between net & use.
          Best wishes,
          PaulH.
          MCP:Server 2003; MCITP:Server 2008; MCTS: SBS2008

          Comment


          • #6
            Re: Login Script to Map Users Personal Drive

            If you want to develop your script further, I suggest you looking at Andrew Hinson's script in this thread: http://forums.petri.com/showpost.php...11&postcount=1 . It contains a check to see if the letter is in use, for instance, thus you will not need to use the net use I: /delete command.

            Sorin Solomon


            In order to succeed, your desire for success should be greater than your fear of failure.
            -

            Comment


            • #7
              Re: Login Script to Map Users Personal Drive

              or, when you map it, use this:

              NET USE I: \\S2003\USERS\%USERNAME% /PERSISTENT:NO

              This means it goes away when you log off...


              Tom
              For my own and your protection, I do not provide support by private message under any circumstances. All such messages will be deleted and ignored.

              Anything you say will be misquoted and used against you

              Comment


              • #8
                Re: Login Script to Map Users Personal Drive

                Originally posted by Stonelaughter View Post
                In my experience the /delete takes a little while to complete and the /use bombs if it hasn't done.
                Maybe Start /Wait for executing Net.exe can provide the nesserary delay.

                Code:
                echo on
                @Start /Wait /B  NET.exe USE * /delete
                
                @NET USE I: \\Server\USERS\%USERNAME% /persistent:no
                - net use
                - start/w
                - "wait" in a batch

                \Rem

                This posting is provided "AS IS" with no warranties, and confers no rights.

                __________________

                ** Remember to give credit where credit's due **
                and leave Reputation Points for meaningful posts

                Comment


                • #9
                  Re: Login Script to Map Users Personal Drive

                  Oops! I made a typo:
                  Originally posted by PaulH View Post
                  netuse I: /delete
                  should be actually net use I: /delete

                  I missed out the space there between net and use but I bet you spotted that !

                  Have a good weekend.
                  Best wishes,
                  PaulH.
                  MCP:Server 2003; MCITP:Server 2008; MCTS: SBS2008

                  Comment


                  • #10
                    Re: Login Script to Map Users Personal Drive

                    Looks alright to me (now).
                    1 1 was a racehorse.
                    2 2 was 1 2.
                    1 1 1 1 race 1 day,
                    2 2 1 1 2

                    Comment

                    Working...
                    X