#42087 - 2003-06-26 04:28 PM
Mapping drives with a label
|
Tom Hendrix
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?
|
|
Top
|
|
|
|
#42089 - 2003-06-27 09:27 AM
Re: Mapping drives with a label
|
Tom Hendrix
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
|
|
|
|
#42091 - 2003-06-27 10:32 AM
Re: Mapping drives with a label
|
Radimus
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...
|
|
Top
|
|
|
|
#42094 - 2003-06-30 02:27 PM
Re: Mapping drives with a label
|
Tom Hendrix
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 ?
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
   
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
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1046 anonymous users online.
|
|
|