Page 1 of 1 1
Topic Options
#206903 - 2013-03-12 07:18 PM Noob Question Regarding Mapping Share
ElJeffe Offline
Just in Town

Registered: 2013-02-27
Posts: 2
Loc: Atlanta, GA
I hope this is the right place for this question and if not, please kindly direct a noob.

I have super limited experience with KIX but here goes.

I have a login script running in a 2008 domain on mostly Win 7 64 clients.

I have created a security group in AD that maps a drive for a user. It is currently mapping using the following:

 Code:
; REM **********************************************************************
; REM **
; REM **  Enterprise My_Drive Group Mapping for \\servername\My_Drive\ to v:\
; REM **  Based on SEC-My_Drive group membership ----- @Comment is for AD Description
; REM **
; REM ***********************************************************************

IF INGROUP ("My_Drive")
  $ErrorNumber = 0
    
    USE V: /DELETE /PERSISTENT
    USE V: "\\@Comment\My_Drive" /PERSISTENT
    IF @ERROR
      $ErrorNumber = $ErrorNumber + @ERROR
      $Dummy = WRITELINE (10, "Could not map My Drive project drive V: \\@Comment\My_Drive" + CHR(13) + CHR(10))
    ELSE
      ? "        Drive V:  \\@Comment\My_Drive"
      $Dummy = WRITELINE (10, "Mapped My_Drive drive V: \\@Comment\My_Drive" + CHR(13) + CHR(10))
    ENDIF


What I want to accomplish is to map the drive using the user's current location assuming the share has been setup on that server.

I've been attempting to use the @Logon variable for testing and getting nowhere fast.

Is there a simple way to do this, or will I have to do something like mapping by subnet?

Many thanks in advance for any advice.



Edited by Glenn Barnas (2013-03-12 08:12 PM)
Edit Reason: Added code tags

Top
#206904 - 2013-03-12 08:24 PM Re: Noob Question Regarding Mapping Share [Re: ElJeffe]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4403
Loc: New Jersey
Welcome to Korg!

You are using Macros in strings, which could impact what's happening. Better method is to use something like:
 Code:
$ResPath = "\\" + @Comment + "\My_Drive"
"Mapping V: to " $ResPath ?
Use $ResPath
The "mapping to.." is just for debugging to make sure you define the variable correctly. Also, you aren't testing to make sure that "@Comment" is actually set, which could cause the mapping to fail. I assume that you're setting the user's comment in their AD Profile to the name of the server you want to connect to. Might work, but will be difficult to maintain.

There's no closing EndIf, but I assume you just didn't copy/paste it into your example.

If you have limited scripting skills, you might want to look at the Kix-based login script on my web site. Free for small businesses and inexpensive for larger environments, it will allow mapping by AD Site, subnet, computer or user OU. Similar to what you're doing with a variable in the mapping path, our script supports macros to dynamically replace the server name, share name, or any/all of the resource path based on 13 different types of macros. With no coding, you can have a basic script running in an hour of reading the manual. It's been deployed and proven at many large, multi-national sites over the past 15 years.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#206905 - 2013-03-13 02:46 AM Re: Noob Question Regarding Mapping Share [Re: Glenn Barnas]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
I'm not sure what @Logon is, since there isn't a built in macro called logon that I know of. But if you are looking to use the logon server, you can try using @LServer, or just the environment variable %logonserver%.

 Code:
USE V: @LServer+"\My_Drive" /PERSISTENT

Top
#206906 - 2013-03-13 11:55 AM Re: Noob Question Regarding Mapping Share [Re: ShaneEP]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4403
Loc: New Jersey
I specifically avoided that example because the OP wanted to map drives by location. If you have multiple DCs, you aren't guaranteed to have your logon processed by the local DC, making the result "iffy", If you only have one DC or the DCs are all at corporate, this won't work at all to map by location.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#206909 - 2013-03-13 06:03 PM Re: Noob Question Regarding Mapping Share [Re: Glenn Barnas]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
Gotcha. Was mostly just responding to his statement of
 Quote:
I've been attempting to use the @Logon variable

Top
#206910 - 2013-03-13 06:12 PM Re: Noob Question Regarding Mapping Share [Re: ShaneEP]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4403
Loc: New Jersey
Yeah - I shook my head on that one too. Thought it might have been a typo since we didn't see the whole script. Your example wasn't wrong, it just would not reliably accomplish the user's intent, with a large amount of potential randomness thrown in. ;\)

ElJeffe - you should also know that you can replace the Chr(13) + Chr(10) in your WriteLine statements with a simple @CRLF macro. In your code, the @CRLF would be required, but for general output, @CRLF can be shortened to a simple "?".

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#206912 - 2013-03-13 08:43 PM Re: Noob Question Regarding Mapping Share [Re: Glenn Barnas]
ElJeffe Offline
Just in Town

Registered: 2013-02-27
Posts: 2
Loc: Atlanta, GA

Sorry, yes it was the @Lserver variable I was referencing.

Thanks for your help on this. Greatly appreciated.

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 2312 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.062 seconds in which 0.03 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