Page 1 of 2 12>
Topic Options
#36315 - 2003-02-11 09:21 PM Windows NT network drive mapping
ktodi Offline
Getting the hang of it

Registered: 2002-03-29
Posts: 60
I have a script written that uses the following lines:

SELECT
;
CASE InGroup ("domain\Domain Admins")
USE h: "\\server\user\@userid"
IF @ERROR = 0
"The H: drive was successfully mapped to the folder " + @userid " on DTS02!"
ELSE
"The H: drive mapping to DTS02 failed! Code @error (@serror)"
ENDIF
;
ENDSELECT

Everything works fine on Win2K pro but when I log into a win nt4 workstation I get Code 53 (The network path cannot be found)

Any advice? Am I missing something? Manually from the run command I can connect to \\server\user\username.

Top
#36316 - 2003-02-11 09:23 PM Re: Windows NT network drive mapping
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
check out the FAQ about mapping network drives.

basically NET USE is different between NT and 2k.

See the FAQ for details and workarounds.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#36317 - 2003-02-11 09:30 PM Re: Windows NT network drive mapping
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
hmmm... I can't find the FAQ...

Well, this is what you will want to do:

code:
	select
Case @producttype = "Windows XP Professional" $os="WinXP" $subcmd="net use"
Case @producttype = "Windows 2000 Professional" $os="Win2K" $subcmd="net use"
Case @producttype = "Windows NT Workstation" $os="WinNT" $subcmd="subst"
endselect
$DriveLetter='M'
$UNC='\\server\share\folder'
shell '%comspec% /c $subcmd $DriveLetter: "$UNC" 1>Nul 2>&1'



[ 11. February 2003, 21:31: Message edited by: Radimus ]
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#36318 - 2003-02-11 09:44 PM Re: Windows NT network drive mapping
ktodi Offline
Getting the hang of it

Registered: 2002-03-29
Posts: 60
I just looked through the 3 pages of FAQs and cannot find one relating to my problem. Can you either send me a link or tell me what the header is?
Top
#36319 - 2003-02-11 09:47 PM Re: Windows NT network drive mapping
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
The basic problem is that NT4 does not support DEEP mapping.

My suggestion would be to create hidden shares for home directories and then map to \\server\share$.

The example above uses the SUBST command to achieve your result.

[ 11. February 2003, 22:22: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#36320 - 2003-02-11 09:52 PM Re: Windows NT network drive mapping
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
See this thread: http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=14;t=000418;p=1#000000
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#36321 - 2003-02-11 10:16 PM Re: Windows NT network drive mapping
ktodi Offline
Getting the hang of it

Registered: 2002-03-29
Posts: 60
This is my script now. Win2k works NT returns Code 1 (incorrect function)

; Setting enviroment variables
;
select
Case @producttype = "Windows XP Professional" $os="WinXP" $subcmd="net use"
Case @producttype = "Windows 2000 Professional" $os="Win2K" $subcmd="net use"
Case @producttype = "Windows NT Workstation" $os="WinNT" $subcmd="subst"
endselect
;
; Home directory Mapping
;
SELECT
;
CASE InGroup ("MT_VIEW\Domain Admins")
$DriveLetter='H'
$UNC='\\dts02\user\@userid'
shell '%comspec% /c $subcmd $DriveLetter: "$UNC" 1>Nul 2>&1'
IF @ERROR = 0
"The H: drive was successfully mapped to the folder " + @userid " on DTS02!"
ELSE
"The H: drive mapping to DTS02 failed! Code @error (@serror)"
ENDIF
;
ENDSELECT

Top
#36322 - 2003-02-11 10:19 PM Re: Windows NT network drive mapping
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
perhaps...
shell '%comspec% /c net use $DriveLetter: /d'
shell '%comspec% /c $subcmd $DriveLetter: /d'

make sure that on your test machine, you don't already have something mapped
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#36323 - 2003-02-11 10:24 PM Re: Windows NT network drive mapping
ktodi Offline
Getting the hang of it

Registered: 2002-03-29
Posts: 60
I don't understand how it will work now if it is missing the "$unc" variable. what is the 1>NUL 2>$1 for?

What is the subst command doing?

Top
#36324 - 2003-02-11 10:26 PM Re: Windows NT network drive mapping
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
the active part in the above if the /d to remove any current mapping... can't map the letter if it is in use.

1>Nul 2>&1 is the magic redirection switches to suppress output from the command
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#36325 - 2003-02-11 10:28 PM Re: Windows NT network drive mapping
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
code:
c:\data\scripts>subst /?
Associates a path with a drive letter.

SUBST [drive1: [drive2:]path]
SUBST drive1: /D

drive1: Specifies a virtual drive to which you want to assign a path.
[drive2:]path Specifies a physical drive and path you want to assign to
a virtual drive.
/D Deletes a substituted (virtual) drive.

Type SUBST with no parameters to display a list of current virtual drives.

_________________________
Home page: http://www.kixhelp.com/hb/

Top
#36326 - 2003-02-11 10:33 PM Re: Windows NT network drive mapping
ktodi Offline
Getting the hang of it

Registered: 2002-03-29
Posts: 60
Only C and D are being used on my test server. I have added one line:

Case @producttype = "Windows NT Server" $os="WinNT" $subcmd="subst"

and it still fails with the same error.

Am I supposed to be putting some variables after the "subst" command?

Top
#36327 - 2003-02-11 10:38 PM Re: Windows NT network drive mapping
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
to make it easy... why don't you get the YAMD() udf, and let it do the work of mapping the drives
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#36328 - 2003-02-11 10:41 PM Re: Windows NT network drive mapping
ktodi Offline
Getting the hang of it

Registered: 2002-03-29
Posts: 60
I will do anything to make this easier. I looke at the KIxtart UDF library and do not see this UDF.
Top
#36329 - 2003-02-11 10:42 PM Re: Windows NT network drive mapping
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
it is more than 10 days old.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#36330 - 2003-02-11 10:43 PM Re: Windows NT network drive mapping
ktodi Offline
Getting the hang of it

Registered: 2002-03-29
Posts: 60
I will do anything to make this easier. I looked at the KIxtart UDF library and do not see this UDF.
Top
#36331 - 2003-02-12 12:00 AM Re: Windows NT network drive mapping
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
Im pretty sure even if you get the code correct that it will not work on NT 4.0 because of the inability to map deep mappings. Can only map to a share. So...

quote:

USE h: "\\server\user\@userid"

Will only work if @userid is actually shared on the server.

EDIT - Nevermind...Just noticed that the UDF uses subst instead of net use.

[ 12. February 2003, 00:03: Message edited by: CitrixMan ]

Top
#36332 - 2003-02-12 12:01 AM Re: Windows NT network drive mapping
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
YAMD()
Top
#36333 - 2003-02-12 03:27 AM Re: Windows NT network drive mapping
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Please read How to use UDFs and take a look at the upper right corner of the KiXtart BBS. There's a) a link to the KiXtart BBS Search with which you can search the forums, and b) a drop-down menu with which you can control how far back you want topic to be displayed. By default, this is 10 days, however, this can also be changed in your profile settings. The profile can also be reached via link in the upper right corner.
_________________________
There are two types of vessels, submarines and targets.

Top
#36334 - 2003-02-12 04:54 PM Re: Windows NT network drive mapping
ktodi Offline
Getting the hang of it

Registered: 2002-03-29
Posts: 60
I logged in with an NT4.0 workstation and the mapping works using the subst command. Thanks for all you help now I gotta get win9x working.
Top
Page 1 of 2 12>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1376 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.156 seconds in which 0.073 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org