#206903 - 2013-03-12 07:18 PM
Noob Question Regarding Mapping Share
|
ElJeffe
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:
; 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
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:$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!
|
|
Top
|
|
|
|
#206905 - 2013-03-13 02:46 AM
Re: Noob Question Regarding Mapping Share
[Re: Glenn Barnas]
|
ShaneEP
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%.
USE V: @LServer+"\My_Drive" /PERSISTENT
|
|
Top
|
|
|
|
#206912 - 2013-03-13 08:43 PM
Re: Noob Question Regarding Mapping Share
[Re: Glenn Barnas]
|
ElJeffe
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
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 2312 anonymous users online.
|
|
|