Drive Mapping in WinNT login script
Results 1 to 12 of 12

Thread: Drive Mapping in WinNT login script

  1. #1
    Join Date
    Jul 2001
    Posts
    23

    Drive Mapping in WinNT login script

    We're running a network with about 350 users and 16 servers. All IBM servers, all Dell workstations. The servers are running Windows NT Server version 4.0 Service Pack 6a; the workstations are running Windows NT Workstation 4.0 Service Pack 5 or 6a. Some workstations are also running windows 2000 Professional. We have two networks, a Novell one and an NT one. We are in the process of phasing out the Novell server because it's sad.. it's too old, and it's full. So we are moving everything slowly from that to the new NT server "file01". A lot of things are done through drive mappings so when we moved a big folder from the novell server to the NT server all we had to do was take a couple lines out of the Novell script that were the mappings, and make an NT script for people to execute that did the same thing except it mapped to file01 instead of Novell. This is a copy of our script for NT:

    net use h: \\file01\%username%
    net use p: \\file01\public

    H: is each individual users directory on the server and P: is pretty self explanatory. Because I am an admin i have a different script that maps a couple additional drives that only the admin's use, this is that script:

    net use h: \\file01\%username%
    net use f: \\file01\data
    net use q: \\file01\users
    net use p: \\file01\public

    The problem is that this new NT script takes a VERY long time to execute. On my personal PC that executes the second script it takes a full minute (sixty seconds, i timed it) to execute. Is there any possible way at all that we can cut down on the execution time of these scripts?

    thanx.. -sr

  2. #2
    Join Date
    Aug 2000
    Location
    Hayward, CA, USA, EARTH
    Posts
    1,852
    One of the reasons it takes long is that if the drive is already mapped an error occurs. Also, the USERNAME variable is pulled from the client PC.

    Here is my login script. It will not map a drive that already exists (thus runs VERY fast).

    @echo off
    net time \\margie /set /y

    @IF NOT EXIST I: NET USE I: \\zeus\installs
    @IF NOT EXIST S: NET USE S: \\margie\SHARE
    @IF NOT EXIST Y: NET USE Y: \\margie\APPS
    @IF NOT EXIST T: NET USE T: \\margie\DATA
    @IF NOT EXIST K: NET USE K: \\margie\SUBMITTALS
    @IF NOT EXIST U: NET USE U: \\margie\%USERNAME%
    call I:\install.bat

    EXIT

    __________________
    The call command calls install routines to check versions and such, make registry entries etc.. The EXIT command makes sure the script ends.



    ------------------
    P933, 133MHZ FSB, 256M RDRAM
    Ultra 160, 18.2GB Cheetah
    Annihilator Pro, SBLIVE, DVD, FPS SOUND
    MS Force Feedback, Cable Modem.
    AKA- The ultimate gaming machine.
    AsusA7N8X, AthlonXP2200
    gForce4600+ti & Audigy Platnium, FPS SOUND. AKA- The ultimate gaming machine (well it WAS three years ago anyway).

  3. #3
    Join Date
    Jul 2001
    Posts
    23
    I tried adding "if not exist " to the beginning of each line of the script. It didn't seem to speed up at all. =( I also tried rem'ing out the line that had "%username%" in it, and it sped up, but only by the amount of time that it would have taken for the system to map that individual drive... so neither of those seemed to work.. what does "net time \\margie /set /y" do in your script? I also didn't quite understand what you meant when you tried to explain what "call I:\install.bat" did. Thanks for the help though..


  4. #4
    Join Date
    Aug 2000
    Location
    Hayward, CA, USA, EARTH
    Posts
    1,852
    The net time sets the client time to = the server time on bootup.

    For the script. Do you have any BDC's in the domain? What are the specs of your server? Try disconnecting ALL network drives and then reboot. See if the script runs any better.

    Is there anything 'special' in your script?

    ------------------
    P933, 133MHZ FSB, 256M RDRAM
    Ultra 160, 18.2GB Cheetah
    Annihilator Pro, SBLIVE, DVD, FPS SOUND
    MS Force Feedback, Cable Modem.
    AKA- The ultimate gaming machine.
    AsusA7N8X, AthlonXP2200
    gForce4600+ti & Audigy Platnium, FPS SOUND. AKA- The ultimate gaming machine (well it WAS three years ago anyway).

  5. #5
    Join Date
    Jul 2001
    Posts
    23
    There is a BDC on the domain. The PDC is in Canton, OH., I am in Keene, NH. The WAN link between here and there is 756k/sec (a few T1's i don't know what lines it's using, i just know it's 756k/sec).

    The File01 server which is what we're dealing with is Dual PIII 933 with 1.31 Gigs of ram. It has Ultra160 RAID - Fourteen seagate cheetah hard drives. C drive (system) is 4 gigs. D drive (data) is 104 gigs. The system is connected to the network thru 16MB Full Duplex Token Ring, and 100MB Ethernet.

    I tried disconnecting all the network drives and rebooting, didn't seem to help at all.

    the login script is exactly as i posted earlier.. although.. there is also a Novell script that is executed before the NT one. That script is this:

    rem /*********************************************************/
    rem /* MPB NT/Novell login script */
    rem /* Created 07/05/2001 by DSR */
    rem /* U and H mapping are removed. */
    rem /* They are now on mpbhfile01 */
    rem /*********************************************************/

    map root F:=sys:data
    map root M:=sys:appl
    map root K:=sys:LOTSHARE
    map root N:=sys:users
    map root Y:=sys ublic\menu

    rem map root U:=vol1:users
    rem map root H:=vol1:users\%LOGIN_NAME

    set NAME="%LOGIN_NAME"

    NO_DEFAULT

    i am seriously stumped...

  6. #6
    Join Date
    Aug 2000
    Location
    Hayward, CA, USA, EARTH
    Posts
    1,852
    When the login script runs, it should indicate what server share it is pulling from (on the title bar?)-

    \\bdc\netlogin

    It is likely that it is pulling the script across the WAN, thus causing the slow down. Try it and see.

    One option is to MOVE all of the map commands in to the NOVELL login script (you can even use their MAP facility) to eliminate the problem.

    Also, you mentioned two interfaces. Is it connected to two SEPERATE networks (they are not bridged somewhere else as well?). Which side is connected to the WAN? Do you have Windows clients on the token ring side? are they affected?

    ------------------
    P933, 133MHZ FSB, 256M RDRAM
    Ultra 160, 18.2GB Cheetah
    Annihilator Pro, SBLIVE, DVD, FPS SOUND
    MS Force Feedback, Cable Modem.
    AKA- The ultimate gaming machine.
    AsusA7N8X, AthlonXP2200
    gForce4600+ti & Audigy Platnium, FPS SOUND. AKA- The ultimate gaming machine (well it WAS three years ago anyway).

  7. #7
    Join Date
    Jul 2001
    Location
    Walsall, W Mids, U.K
    Posts
    2
    Try adding c: (or whatever you boot drive is on the pc) to the end of the script and see if this works.

    We had similar problem and this cured it.

    Regards,



    ------------------
    Mark Taylor
    Mark Taylor

  8. #8
    Join Date
    Jul 2001
    Location
    Walsall, W Mids, U.K
    Posts
    2
    Try adding c: (or whatever you boot drive is on the pc) to the end of the script and see if this works.

    We had similar problem and this cured it.

    Regards,



    ------------------
    Mark Taylor
    Mark Taylor

  9. #9
    Join Date
    Jul 2001
    Posts
    23
    Okay.. I've been messing around with the script all day now and this is what i have come up with:

    @echo off
    echo Welcome to Timken Super Precision - MPB
    echo Please do NOT close this window!
    echo ________________
    echo ::Mapping drives...
    if not "%OS%"=="Windows_NT" goto Win9x
    if not exist h: echo mapping H: to mpbhfile01\%username%...
    if not exist h: net use h: \\mpbhfile01\%username% /home /persistent:yes
    if not exist f: @echo mapping F: to mpbhfile01\data...
    if not exist f: net use f: \\mpbhfile01\data /persistent:yes
    if not exist q: @echo mapping Q: to mpbhfile01\users...
    if not exist q: net use q: \\mpbhfile01\users /persistent:yes
    if not exist p: @echo mapping P: to mpbhfile01\public...
    if not exist p: net use p: \\mpbhfile01\public /persistent:yes
    goto :end
    :Win9x
    if not exist h: echo mapping H: to mpbhfile01\%username%...
    if not exist h: net use h: \\mpbhfile01\%username%
    if not exist f: @echo mapping F: to mpbhfile01\data...
    if not exist f: net use f: \\mpbhfile01\data
    if not exist q: @echo mapping Q: to mpbhfile01\users...
    if not exist q: net use q: \\mpbhfile01\users
    if not exist p: @echo mapping P: to mpbhfile01\public...
    if not exist p: net use p: \\mpbhfile01\public
    :end
    echo ::Finished mapping drives...
    echo ::Have a nice Day..
    sleep 4
    exit

    I put the stuff in the beginning because we have many users that didn't know what the window was and closed it before they knew what they were doing. This script takes a long time to run.. the first time it is run. But the persistant switch at the end makes the drives stay mapped even if you shut down the computer and if they're already mapped then the "if not exist" command at the beginning of each line skips over it and makes it run very fast. So that's good enough for my boss, and what's good enough for my boss is good enough for me. Thank you soo much for the help on that one.

    My problem now is that We still have some win95 clients on the network and this script doesn't work with them. I have a win95 test machine that i am testing this with and the machine doesn't seem to be even trying to run the script. sometimes it does and sometimes it doesn't. I have yet to find a pattern to the chaos. Any suggestions on this one?

    Again, thanx for all the help.. -sr

  10. #10
    Join Date
    Aug 2000
    Location
    Hayward, CA, USA, EARTH
    Posts
    1,852
    Hey nemi-

    Your script wont run all of the time if it does not exist in the NETLOGIN directory of the PDC and ALL BDC's. As an example, here I have the PDC in Hayward and a BDC in San Jose and Rocklin. The script will run from the first server that answers. Thus my suggestion to check the sharename that the script was pulling from (the PDC is preferenced BTW).

    The %username% variable won't work at all on Win9x (unless you are using Kixstart).

    Hope this additional info helps...

    ------------------
    P933, 133MHZ FSB, 256M RDRAM
    Ultra 160, 18.2GB Cheetah
    Annihilator Pro, SBLIVE, DVD, FPS SOUND
    MS Force Feedback, Cable Modem.
    AKA- The ultimate gaming machine.
    AsusA7N8X, AthlonXP2200
    gForce4600+ti & Audigy Platnium, FPS SOUND. AKA- The ultimate gaming machine (well it WAS three years ago anyway).

  11. #11
    Join Date
    Jul 2001
    Posts
    23
    the main problem that i had when i opened this topic has been solved so i am going to open another topic with the other problem that i am having, any admin can close this one if they want to.

  12. #12
    Join Date
    Jul 2001
    Posts
    23
    Originally posted by patweb:
    Hey nemi-

    Your script wont run all of the time if it does not exist in the NETLOGIN directory of the PDC and ALL BDC's. As an example, here I have the PDC in Hayward and a BDC in San Jose and Rocklin. The script will run from the first server that answers. Thus my suggestion to check the sharename that the script was pulling from (the PDC is preferenced BTW).

    The %username% variable won't work at all on Win9x (unless you are using Kixstart).

    Hope this additional info helps...

    I can't put the script in the PDC because there are about 15 other businesses that use that PDC that are very different networks from this one. (Major corporation that owns 16 other smaller - but still big - businesses like the one i work for). But, i found out from a colleague of mine that we actually have two BDC's on this network and i only knew of one of them, so the script is now in both. For some strange reason all of the NT workstation machines on this network ALWAYS look in mpbhdns01(Primary BDC) for the script, and this 95 machine just happened to always look in mpbh0004 (the other BDC) for the script. very wierd.
    I also added a few lines to the script to get it to recognize the %username% variable:
    Code:
      rem Creating the variable %Username%
      net config | find /I "User">us!r.bat
      echo set USERNAME=%%2>user.bat
      call us!r.bat
      del us?r.bat >null
    Works fine now.. thanks..

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •