Page 1 of 3 123>
Topic Options
#166946 - 2006-09-06 12:35 PM Mapping network drives
ddady Offline
Getting the hang of it

Registered: 2006-09-03
Posts: 98
Hi to you all again.

What is wrong with this code:

; ============== Mapping Network Drives ================

Color r+/n
at (6,10) "Installing Network Drives Please Wait..."
sleep 5

if ingroup ("Shiklolit_Group")
use S: "\\dc\data$\programs"
endif

if ingroup ("Bezeq_Zahav_Group")
use z: "\\dc\data$\goldnet"
endif

if ingroup ("General_Data_Group")
use m: "\\dc\data$"
endif


After the script runs all i'm getting is the 'm' drive mapped, i have double checked that the user is a member in all groups.

Thanx in advance.

Top
#166947 - 2006-09-06 01:06 PM Re: Mapping network drives
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
See the manual in regard to the use of "$$" for the "$" character in strings. See also SetOption("NoVarsInStrings",...) for another way around this issue.

Include some error checking after the map attempts - if you'd printed the result of the failure it would have given you a clue about what is going on.

Top
#166948 - 2006-09-06 01:18 PM Re: Mapping network drives
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Don't know, but you can maybe try to debug and find where the real problems are
Suggestion:
Code:

If NOT @LOGONMODE
Break ON
EndIf
Dim $SO
$SO = SetOption("Explicit","On")
$SO = SetOption("NoMacrosInStrings","On")
$SO = SetOption("NoVarsInStrings","On")
$SO = SetOption("WrapAtEOL","On")
;Use this while debugging or when making changes to the groups you are in
$SO = DelTree("HKEY_CURRENT_USER\Software\KiXtart\TokenCache")
If InGroup("Shiklolit_Group")
Use S: /DELETE /PERSISTENT
Use S: "\\dc\data$\programs"
Else
? "You are not in group Shiklolit_Group"
EndIf
If InGroup("Bezeq_Zahav_Group")
Use Z: /DELETE /PERSISTENT
Use Z: "\\dc\data$\goldnet"
Else
? "You are not in group Bezeq_Zahav_Group"
EndIf
If InGroup("General_Data_Group")
Use M: /DELETE /PERSISTENT
Use M: "\\dc\data$"
Else
? "You are not in group General_Data_Group"
EndIf


Top
#166949 - 2006-09-06 01:21 PM Re: Mapping network drives
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Oh yes, like Richard says,
Code:

Dim $SO
$SO = SetOption("NoVarsInStrings","On")


will be your friend

Top
#166950 - 2006-09-06 02:19 PM Re: Mapping network drives
ddady Offline
Getting the hang of it

Registered: 2006-09-03
Posts: 98
So, basically you are saying that the $ sign in "\\dc\data$\programs" is what causing the problems?
Top
#166951 - 2006-09-06 02:38 PM Re: Mapping network drives
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Yes, I think so
That is, if you did not use something like:
$SO = SetOption("NoVarsInStrings","On")
Like Richard suggested, it is in the KiX manual (on page 28).
There could be other problems I can think about, like:
- incorrect path in the Use Command
- the WS you are working on is an NT4 and it does not support deep mapping

Top
#166952 - 2006-09-06 02:42 PM Re: Mapping network drives
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
I do not understand why you want to deep map to a share you allready mapped. You could use Windows Security to deny access to someone who is not in group Shiklolit_Group and Bezeq_Zahav_Group.
In that way, you keep S: and Z: for better occasions.

Top
#166953 - 2006-09-06 02:47 PM Re: Mapping network drives
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
If $ were the culprit, then why does M: map as it has a $ in the path? What OS is the client? Not all support deep mapping.
Top
#166954 - 2006-09-06 02:50 PM Re: Mapping network drives
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
True, I saw it. Maybe it was mapped persistent? I just made ddady delete it in the example script I gave.
Top
#166955 - 2006-09-06 02:59 PM Re: Mapping network drives
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Quote:

If $ were the culprit, then why does M: map as it has a $ in the path? What OS is the client? Not all support deep mapping.




You may recall back in the early days Ruud introduced special handling for "$" when it is the last character in a string, specifically to handle hidden shares names prior to general OS support for deep mapping.

Having said that, I've just tried to break it and I couldn't.

Definately put the error checking in, it's invaluable in determining the reason for the failure.

For those client that fail you could also try the mapping at the command line and see if it works.


Edited by Richard H. (2006-09-06 03:06 PM)

Top
#166956 - 2006-09-06 03:17 PM Re: Mapping network drives
ddady Offline
Getting the hang of it

Registered: 2006-09-03
Posts: 98
Quote:

I do not understand why you want to deep map to a share you allready mapped. You could use Windows Security to deny access to someone who is not in group Shiklolit_Group and Bezeq_Zahav_Group.
In that way, you keep S: and Z: for better occasions.




I'll explain,first of all i know that i can use the windows security for denying access, BUT, i need those deep mapped paths since there are programs on those computers that their database is on the server [dc].

The paths are correct i have checked them on the command line, the server is Windows Server 2003 and the computers are also Win98 and XP. The script doesnt work on either one.

"Richard" so you are saying that the 'M' path worked because the in the code the $ sign is at the end and in the rest is in the middle?

Top
#166957 - 2006-09-06 03:20 PM Re: Mapping network drives
ddady Offline
Getting the hang of it

Registered: 2006-09-03
Posts: 98
BTW, i can't thank you guys enough for all your help, you respond so quick.

Cheers!!!

Top
#166958 - 2006-09-06 03:36 PM Re: Mapping network drives
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Win98 will never deep map so your plan is flawed.
Top
#166959 - 2006-09-06 03:48 PM Re: Mapping network drives
ddady Offline
Getting the hang of it

Registered: 2006-09-03
Posts: 98
Quote:

Win98 will never deep map so your plan is flawed.




Ok' i can live with that, it's only 2 or 3 computers that i can map them manually, but what about the rest??

If i will enable the NoVar option it will work on the xp?

Top
#166960 - 2006-09-06 03:56 PM Re: Mapping network drives
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Also on the Win98 boxes, you must not remap the Z: drive in a logon script. It is in use by the redirector.

What makes you think that it is the MAP parms that are failing you? My guess is that InGroup() and the token cache are letting you down or you are testing without logging off.

Top
#166961 - 2006-09-06 04:10 PM Re: Mapping network drives
ddady Offline
Getting the hang of it

Registered: 2006-09-03
Posts: 98
Well, the thing is the 98 computers are not in the group that get the Z mapped drive but that's not a problem i can choose a different drive letter.

I have been told here that the $ sign might causing the problem, and regarding the InGroup() i did the same thing for printers and it worked just great, here is the code.

if ingroup("Oki5300_Printer_Group")
addprinterconnection("\\dc\Oki5300")
endif

if ingroup("Oki5400_Printer_Group")
addprinterconnection("\\dc\Oki5400")
endif

if ingroup("OkiAcc_Printer_Group")
addprinterconnection("\\dc\OkiAcc")
endif

Top
#166962 - 2006-09-06 04:19 PM Re: Mapping network drives
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Try running this script on a failing XP machine:
Code:
If InGroup("Shiklolit_Group")
udfMyUse("S:","\\dc\data$$\programs")
EndIf

If InGroup("Bezeq_Zahav_Group")
udfMyUse("y:","\\dc\data$$\goldnet")
EndIf

If InGroup("General_Data_Group")
udfMyUse("m:","\\dc\data$$")
EndIf

Function udfMyUse($sDrive,$sPath)
Use $sDrive /delete /persistent
"Mapping drive "+$sDrive+" to '"+$sPath+"' "
Use $sDrive $sPath
If @ERROR
"failed"+@CRLF+"Reason: ["+@ERROR+"] "+@SERROR+@CRLF
Else
"worked"+@CRLF
EndIf
EndFunction


Top
#166963 - 2006-09-06 04:38 PM Re: Mapping network drives
ddady Offline
Getting the hang of it

Registered: 2006-09-03
Posts: 98
Thanx Richard, but actually your first suggestion workd just fine on the xp comp.

I add the setoption ("NoVarsInStrings","ON") and it worked just perfect. I think it will work too on the Win98, but i have to delete first the mapped drives that already were configured manually, and try the script again, or to add some code that delete all drives in the first line.

I still have to learn how to use the debug and error commands.

Top
#166964 - 2006-09-06 05:48 PM Re: Mapping network drives
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
You can delete the mappings selectively, just as in my example.
Top
#166965 - 2006-09-07 10:07 AM Re: Mapping network drives
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Quote:

I think it will work too on the Win98, but i have to delete first the mapped drives that already were configured manually, and try the script again, or to add some code that delete all drives in the first line.




Examine the simple script that I provided. It moves the common code (debugging, drive deleting, drive mapping) into a User Defined Function so you only need to write or amend it once. Whenever you attempt to map a drive letter it deletes it first.

Win98 probably doesn't support "deep" mapping, which is where you map to a sub-directory of a share point. You *may* be able to use the DOS "SUBST" command to achieve the same effect once you have mapped the parent directory but I don't have a Win98 box to test on.

Top
Page 1 of 3 123>


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

Who's Online
1 registered (Allen) and 1198 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.149 seconds in which 0.093 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