Page 1 of 1 1
Topic Options
#203976 - 2011-12-21 07:34 AM Complex Home Drive Mapping Possible?
Ken_Thomas Offline
Fresh Scripter

Registered: 2007-02-09
Posts: 6
It's been a while since I've posted here. Working for a new company that has never used login scripts to map drives. In the past I've used something like:

 Code:
 USE H: "\\FILESERVER\HOMESHARE\%USERNAME%" 


This works great if everyone's home drive is under \\FILESERVER\HOMESHARE\. The way these were created at my new company is \\FILESERVER\HOMESHARE\USERA, for users that have A as their first initial. So Allen, Amy, Aaron, etc. would all be under folder USERA. This is repeated for all users of the alphabet. My name is Ken, so mine is listed under "USERK".

Any way to make this scenerio work with KIX?


Edited by Ken_Thomas (2011-12-21 07:55 AM)

Top
#203977 - 2011-12-21 08:05 AM Re: Complex Home Drive Mapping Possible? [Re: Ken_Thomas]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Hi Ken,

The code below is an example that could do the trick but it assumes some things that might not be true for you environment.

It assumes that the user ID starts with your first name or the first letter of your first name. It also assumes that the name of the home folder is the same as your user ID. It is basically a proof of concept and shows that it can be done.

Getting the first name from AD is also possible if (part of) your first name is not in the user ID. It depends a bit on how things are set up in your environment.

 Code:
Break on

;Get initial
$inital = SubStr(@USERID, 1, 1)

;Set path to home folder
$path = "\\fileserver\homeshare\User" + $initial + "\" + @USERID

;Set drive to use for home folder mapping
$drive = "H:"

;Delete the drive
Use $drive /delete /persistent

;Map correct drive
Use $drive $path


Edited by Mart (2011-12-21 08:08 AM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#203983 - 2011-12-21 07:07 PM Re: Complex Home Drive Mapping Possible? [Re: Ken_Thomas]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
If you want a pre-built solution, our Universal Login Script product (Kix based) will do this with Value Rewrites. Value rewrites allow part of the UNC path to be dynamically replaced based on user, User OU, Computer OU, AD Site, IP subnet, and more. The user manual is posted on our web site, and the login script is free to download. Your specific requirement would employ rewrites with a small block of user-defined code to extract the initial.

The script is tokenized, which allows us to provide commercial support. It does support locally coded extensions for special situations. It's fast, too - a complex configuration with several 500-entry rewrite tables, about 30 disk resource mappings, plus printer, message, and command resource records runs in about 4-6 seconds.

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

Top
#203984 - 2011-12-21 08:23 PM Re: Complex Home Drive Mapping Possible? [Re: Glenn Barnas]
Ken_Thomas Offline
Fresh Scripter

Registered: 2007-02-09
Posts: 6
Thanks Glenn - I downloaded your script and looked at the rewrites but couldn't figure them out. I may take a more in depth look if this doesn't satisfy my needs.
Top
#203985 - 2011-12-21 10:23 PM Re: Complex Home Drive Mapping Possible? [Re: Mart]
Ken_Thomas Offline
Fresh Scripter

Registered: 2007-02-09
Posts: 6
Worked great, thanks! I did have to troubleshoot a little because there was a typo of the word "initial" but all is well.
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 1441 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.059 seconds in which 0.026 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