Solved

Remapping Drives Using Logon Scripting

Posted on 2001-06-12
5
465 Views
Last Modified: 2010-04-13
I am working on a logon scripting problem for the first time. My problem is basically how do I remap drives to there correct locations in script? I am in a mixed evironment with win2k server and win2k pro/ win98/ mac workstations.
0
Comment
Question by:Khanpk197
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 

Accepted Solution

by:
jhawklyn earned 100 total points
ID: 6182622
NET USE  - probably the command you'll need.  (Except the Mac....)
- some steps
1. Check that the drive isn't already mapped correctly.
2. map if it isn't available
3. check that the drive as mapped is mapped to a known location if it isn't unmap it. - remap.

Assumption: Username/password on current machine matches username and password on destination machine.

Below sample bat file would map a 'J' Drive to a specific location:
==== Begin MapSample.BAT =======
@echo off
REM PREMISE Drive to be mapped has known location ie: J:\EVAL
REM This sample bat file demo's mapping to Drive 'J'
if exist j:\eval\nul goto Done
REM check for mapping to 'wrong' location,  unmap to then do drive  remap.
if exist j:\nul net use j:  /delete
REM Map the drive
net use j: \\machine\volume
REM Check for success
if exist j:\eval\nul goto Done
:Error
Echo ERROR: Drive NOT mapped to j:\eval as expected.
Goto End
:Done
Echo Drive J is mapped
:End
==== End MapSample.Bat
0
 
LVL 63

Expert Comment

by:SysExpert
ID: 6182850
Sounds good so far.

Also. win9x/ME can not map drive Z: ,  NT can.

It is going to be difficult to map more than one or 2 drives if you want to be consistent.

I would start at drive M or N or higher.

 I hope this helps !
0
 
LVL 63

Expert Comment

by:SysExpert
ID: 6182878
From Tim , regarding finding the first free drive letter:

From: tim_holman                               Date: Wednesday, November 22 2000 - 04:01AM EST

                     In a batch script, try this:

                      net use * \\nt4_pdc\public > test.txt
                     for /f "tokens=2,3*" %%i in ('findstr "Drive" test.txt') do set drive=%%i

                     This will set the variable 'Drive' to whatever drive * has found.

                     From: timdog                                    Date: Wednesday, November 22 2000 - 08:59AM EST

Jeez, I thought you had it!  Almost there. I receive an error message saying that /F"tokens=2,3*" was unexpected at this time.
    From: tim_holman                                             Date: Wednesday, November 22 2000 - 10:14AM EST

                     net use * \\nt4_pdc\public > test.txt
                     for /f "tokens=2" %%i in ('findstr "Drive" test.txt') do set drive=%%i

                     You don't need the 3*, but it shouldn't matter.

                     Have you enough drives left to map ?

                     This works fine for me - NT 4, SP6a...
-----------------
I hope this helps !
0
 
LVL 3

Expert Comment

by:hendrik999
ID: 6182996
Please use a real login script program called KixTart.
It is freeware and programmed by Ruud van Velsen of Microsoft Benelux.
I'm working for a long while with this program and it is the best option if you want to use login scripts.
For more information please look at
http://netnet.net/~swilson/kix/

With KixTart you can (re)map drives via the following command:

  use f: /del /persistent
  use f: "\\servername\sharename"
0
 
LVL 3

Expert Comment

by:hendrik999
ID: 6183025
A better KixTart site is actually
http://kixtart.org/helpdesk/
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question