Page 1 of 1 1
Topic Options
#183216 - 2007-12-03 09:00 PM Drive mappings depending on logon server
choey Offline
Fresh Scripter

Registered: 2007-12-03
Posts: 5
We are an educational environment. We have many users that roam between buildings and their drive mappings need to change depending on the building they are in. If they are in 1 school, they need to map drive G to the server in that building's Apps folder. If they are in another building, they need to map that server's Apps folder and so on. Below is the primitive logon batch file I have been using, which actually works. It is very slow though and I would like to convert it to Kix. Notice that I have 2 servers in each building, but the drives need to be mapped to the fs1 in each building. Also, I have about 15 buildings. I only pasted in the portion from 2 of the buildings. Thanks to anyone who can help me.

Chris

if /i "%LOGONSERVER%"=="\\ps01-fs1" (net use g: \\ps01-fs1\apps)
if /i "%LOGONSERVER%"=="\\ps01-fs2" (net use g: \\ps01-fs1\apps)
if /i "%LOGONSERVER%"=="\\ps01-fs1" (net use i: \\ps01-fs1\installs)
if /i "%LOGONSERVER%"=="\\ps01-fs2" (net use i: \\ps01-fs1\installs)
if /i "%LOGONSERVER%"=="\\ps01-fs1" (net use r: \\ps01-fs1\resources)
if /i "%LOGONSERVER%"=="\\ps01-fs2" (net use r: \\ps01-fs1\resources)
if /i "%LOGONSERVER%"=="\\ps01-fs1" (net use t: \\ps01-fs1\ttl_net)
if /i "%LOGONSERVER%"=="\\ps01-fs2" (net use t: \\ps01-fs1\ttl_net)
if /i "%LOGONSERVER%"=="\\ps01-fs1" (net use m: \\ps01-fs2\smecourses)
if /i "%LOGONSERVER%"=="\\ps01-fs2" (net use m: \\ps01-fs2\smecourses)
if /i "%LOGONSERVER%"=="\\ps01-fs1" (net use s: \\ps01-fs2\sme)
if /i "%LOGONSERVER%"=="\\ps01-fs2" (net use s: \\ps01-fs2\sme)

if /i "%LOGONSERVER%"=="\\ps04-fs1" (net use g: \\ps04-fs1\apps)
if /i "%LOGONSERVER%"=="\\ps04-fs2" (net use g: \\ps04-fs1\apps)
if /i "%LOGONSERVER%"=="\\ps04-fs1" (net use i: \\ps04-fs1\installs)
if /i "%LOGONSERVER%"=="\\ps04-fs2" (net use i: \\ps04-fs1\installs)
if /i "%LOGONSERVER%"=="\\ps04-fs1" (net use r: \\ps04-fs1\resources)
if /i "%LOGONSERVER%"=="\\ps04-fs2" (net use r: \\ps04-fs1\resources)
if /i "%LOGONSERVER%"=="\\ps04-fs1" (net use t: \\ps04-fs1\ttl_net)
if /i "%LOGONSERVER%"=="\\ps04-fs2" (net use t: \\ps04-fs1\ttl_net)
if /i "%LOGONSERVER%"=="\\ps04-fs1" (net use m: \\ps04-fs2\smecourses)
if /i "%LOGONSERVER%"=="\\ps04-fs2" (net use m: \\ps04-fs2\smecourses)
if /i "%LOGONSERVER%"=="\\ps04-fs1" (net use s: \\ps04-fs2\sme)
if /i "%LOGONSERVER%"=="\\ps04-fs2" (net use s: \\ps04-fs2\sme)

Top
#183219 - 2007-12-03 09:30 PM Re: Drive mappings depending on logon server [Re: choey]
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
This would be fairly easy to re-write based on IP subnets. Do you have a well defined mapping of subnets per building?

I would be happy to write something to satisfy the need if supplied with the data.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#183222 - 2007-12-03 10:00 PM Re: Drive mappings depending on logon server [Re: choey]
NTDOC Administrator Online   content
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Here is an example of doing in KiX.

I thought about IP based like Howard mentions but did not think you would have it setup like that so I didn't go down that road. Also doing by IP can be quite problematic especially for laptops


 Code:
;Remove all drive mappings so we dont have an old one
USE * /DELETE

Select
  Case @LServer = '\\ps01-fs1' Or @LServer = '\\ps01-fs2'
    USE G: '\\ps01-fs1\apps'
    USE I: '\\ps01-fs1\installs'
    USE R: '\\ps01-fs1\resources'
    USE T: '\\ps01-fs1\ttl_net'
    USE M: '\\ps01-fs2\smecourses' ;your example here is not using server 1
    USE S: '\\ps01-fs2\sme' ;your example here is not using server 1
  Case @LServer = '\\ps04-fs1' Or @LServer = '\\ps04-fs2'
    USE G: '\\ps04-fs1\apps'
    USE I: '\\ps04-fs1\installs'
    USE R: '\\ps04-fs1\resources'
    USE T: '\\ps04-fs1\ttl_net'
    USE M: '\\ps04-fs2\smecourses' ;your example here is not using server 1
    USE S: '\\ps04-fs2\sme' ;your example here is not using server 1
  Case 1
    'Unable to determine server so doing nothing'
EndSelect


Top
#183224 - 2007-12-03 10:04 PM Re: Drive mappings depending on logon server [Re: NTDOC]
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Without asking additional questions, I have a concern about only relying on logon server as the way of determining what building the computer is located.

I have seen some instances where the expected authentication server was not the actual logon server. This would lead to extremely slow performance as the drives would be mapped to the wrong building.


Edited by Howard Bullock (2007-12-04 05:40 AM)
Edit Reason: spelling
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#183228 - 2007-12-03 10:28 PM Re: Drive mappings depending on logon server [Re: Howard Bullock]
NTDOC Administrator Online   content
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Completely agree Howard.

I just assumed that the servers in different buildings are all STAND ALONE and not part of an overall Domain structure. If not and they are all connected then I agree it can be an issue.

Top
#183233 - 2007-12-03 11:26 PM Re: Drive mappings depending on logon server [Re: NTDOC]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
If they are part of an overall Domain Structure, one would have to assume Campus level wiring, so why map to each "buildings" server and just run it across the LAN instead, Static Mappings (so to speak).
_________________________
Today is the tomorrow you worried about yesterday.

Top
#183247 - 2007-12-04 09:48 AM Re: Drive mappings depending on logon server [Re: Howard Bullock]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
 Originally Posted By: Howard Bullock
Without asking additional questions, I have a concern about only relying on logon server as the way of determining what building the computer is located.

I have seen some instances where the expected authentication server was not the actual logon server. This would lead to extremely slow performance as the drives would be mapped to the wrong building.


Good point, but wouldn't that indicate an issue with AD configuration or the authenticating server?

If the former then it should be fixed in the configuration, not the mapping script.

If the latter, then you probably *want* the drives to be mapped to a non-local server, as there is a problem with the local server. There is not much point in attempting to force the mapping to a local server based on IP address if it is down.

If the buildings are all set up the same way then you can reduce the code to a generic form:

 Code:
;Remove all drive mappings so we dont have an old one
USE * /DELETE
 
$sSite=Split(@LServer,"-")[0]
USE G: $sSite+'-fs1\apps'
USE I: $sSite+'-fs1\installs'
USE R: $sSite+'-fs1\resources'
USE T: $sSite+'-fs1\ttl_net'
USE M: $sSite+'-fs2\smecourses'
USE S: $sSite+'-fs2\sme'

Top
#183248 - 2007-12-04 10:16 AM Re: Drive mappings depending on logon server [Re: Richard H.]
NTDOC Administrator Online   content
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Very nice Richard. Still got that Golfing in the blood.

Was thinking of doing something like that but was too "busy/lazy" to code it up.

Bottom line is that more details are needed to make a better choice, but hopefully I think he gets the idea of what can be done.

Top
#183399 - 2007-12-07 03:52 PM Re: Drive mappings depending on logon server [Re: NTDOC]
choey Offline
Fresh Scripter

Registered: 2007-12-03
Posts: 5
This looks like what I am looking for. I am out of the office on jury duty, so it will be a few days before I can try it. That's also the reaseon for the dely in this response.

Thank you very much.

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 1471 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.075 seconds in which 0.04 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