Solved

Remapping Drives Using Logon Scripting

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now