Page 1 of 1 1
Topic Options
#42087 - 2003-06-26 04:28 PM Mapping drives with a label
Tom Hendrix Offline
Fresh Scripter

Registered: 2003-06-26
Posts: 5
Loc: Belgium
I was able to map drives without a label !
But I can't get a label to work !?!?!
It always gives a name like 'sharedfolder on server2'

The client PC's are windows 2k & XP

What can be wrong? [Confused]

Top
#42088 - 2003-06-26 04:31 PM Re: Mapping drives with a label
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Please take a look at the various 'map drive' UDFs and the Label() UDF that are posted in the UDF Forum. They allow to apply a label to a mapped drive.
_________________________
There are two types of vessels, submarines and targets.

Top
#42089 - 2003-06-27 09:27 AM Re: Mapping drives with a label
Tom Hendrix Offline
Fresh Scripter

Registered: 2003-06-26
Posts: 5
Loc: Belgium
Hello,

I used this script , but it maps without the correct label.
What can be wrong ?

Function MapDrive($DriveLetter, $UNC, optional $Label, optional $Icon, optional $Delete, optional $persistent) dim $subcmd,

$pt, $d, $di, $shell, $per $d = left($DriveLetter,1) $di=

"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DriveIcons" $pt= @producttype if $pt =

"Windows NT Workstation" $subcmd="subst" $per='' else $subcmd="net use"

if $persistent $per='/PERSISTENT ' endif endif if $delete shell '%comspec% /c

$subcmd $d: /d $per 1>Nul 2>&1' $=deltree("$di\$D") endif shell '%comspec% /c $subcmd $D: "$UNC" $per

1>Nul 2>&1' if not exist('$D:\') exit 1 return endif if $pt="Windows XP

Professional" or $pt="Windows 2000 Professional" if $Label

$shell=createobject("shell.application") $shell.namespace('$D:\').self.name=$Label

endif if $icon $=writevalue('$di\$D\DefaultIcon','','$Icon',REG_SZ) endif

endif ENDFUNCTION

MapDrive("x","\\server1\general","Test share","C:\WINNT\system32\moricons.dll,21",1)

Top
#42090 - 2003-06-27 10:07 AM Re: Mapping drives with a label
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
2 things.
1st is that you don't use the code tags provided by the board and that makes your post really messy [Big Grin]

what comes to labeling part, it's direct copy&paste from the label() udf and there seems to be timeout issues using it this way.

with persistent connections the other mapdrive() udf has proven to work quite well.
one solution is to just map the drives and then after that, use the label() to set the label.
this way there is delay which should take care of this thingie.

also runlogonscriptsync can affect that...
_________________________
!

download KiXnet

Top
#42091 - 2003-06-27 10:32 AM Re: Mapping drives with a label
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
it isn't code tags, but a copy patse from the board which lost the CR

That shouldn't make a difference to the working of the function, but It could be...
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#42092 - 2003-06-27 10:47 AM Re: Mapping drives with a label
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
no, I wasn't talking about possible errors.
I was talking about his post being screwed badly and thus being almost unreadable.

what comes to the labeling problem, gave some shots at it.
it's known problem (amongst inner-circle) so there is not much anyone can do as it would have been done already.
_________________________
!

download KiXnet

Top
#42093 - 2003-06-27 06:49 PM Re: Mapping drives with a label
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Or try this one: MapDrive() - Maps a UNC name to a specific driveletter .

BTW, it is sufficient to reference a UDF incl. URL instead of posting it.
_________________________
There are two types of vessels, submarines and targets.

Top
#42094 - 2003-06-30 02:27 PM Re: Mapping drives with a label
Tom Hendrix Offline
Fresh Scripter

Registered: 2003-06-26
Posts: 5
Loc: Belgium
This is working fine now (including icon's and names) thx guys!

Now I have another problem.

I activated run logon scripts synchronously (for users) for getting the mapping to work but some users cannot logon anymore because some parts of the script won't execute ... How should I fix this ??? setting up a script timeout or something ? how do I do that ? [Confused]

note : the scripts are working fine but stops because he tries to make a network mapping wich already exists. I also made a logoff script wich unmappes all the network drives... Is this a good solution ?

[ 30. June 2003, 14:29: Message edited by: Tom Hendrix ]

Top
#42095 - 2003-06-30 02:46 PM Re: Mapping drives with a label
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
delete the mapped drive before trying to connect it

if the script just ends, you probably have an open quote somewhere, or a script error
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#42096 - 2003-06-30 03:03 PM Re: Mapping drives with a label
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
The UDF, which link I posted, will recognize incorrectly mapped drives and will remove the incorrect drive map before mapping to the correct UNC. It will alos set/remove persistent connections.
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


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

Who's Online
0 registered and 1046 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.14 seconds in which 0.101 seconds were spent on a total of 12 queries. Zlib compression enabled.

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