Solved

Remapping Drives Using Logon Scripting

Posted on 2001-06-12
5
464 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

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…
Not everyone has adapted to a rapid advancement in technology; there are people who are reluctant or afraid to delve into this brave new world of IT. If you have a friend or a family member who suffers from the so-called technophobia, here is how yo…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

738 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