Feedback| Site Map| About| Privacy

Logon Script To Attach To A Server Based On IP Address

 
Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [Languages] >> Batch Scripting >> Logon Script To Attach To A Server Based On IP Address Page: [1]
Login
Message << Older Topic   Newer Topic >>
Logon Script To Attach To A Server Based On IP Address - 6/16/2005 10:13:28 PM   
tuxhoover

 

Posts: 4
Joined: 6/16/2005
Status: offline
I was wondering if someone could help me create a windows logon script, that would check the IP Address of a computer, and depending on the IP it would map a network drive according to the IP Address and that persons logon name. Example, if the ip address was 10.76.128.xxx it would map Z: to \\server1\%username% and if the ip address was 10.76.129.xxx it would map Z: to \\server2\%username%

Is this possible? Any help would be appreciated.

Jeremy Hoover
hoover@hooveronline.net
Post #: 1
RE: Logon Script To Attach To A Server Based On IP Address - 6/17/2005 10:24:47 AM   
bphilhower

 

Posts: 4
Joined: 7/14/2002
Status: offline
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Establishes $location variable, determined by subnet
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
:IPCHECK
$address = @IPADDRESS0
$subnet = SubStr($address,9,3)
$subnet1 = SubStr($address,13,3)
Select
Case $subnet = "xxx" And $subnet1 >= "xxx" And $subnet1 <= "xxx"
$location = servername-1
"net use d: \\" & $location &"\" & @username &" /persistent"
Case (($subnet = "xxx" And $subnet1 >= "xxx" And $subnet1 <= "xxx") $location = servername2
"net use d: \\" & $location &"\" & @username & " /persistent"
EndSelect
or something to that effect...

(in reply to tuxhoover)
Post #: 2
RE: Logon Script To Attach To A Server Based On IP Address - 6/17/2005 11:50:05 AM   
tuxhoover

 

Posts: 4
Joined: 6/16/2005
Status: offline
I couldn't get this to work. I just need a simple iplogon.bat file. I'm willing to pay for this. Please contact me at hoover@hooveronline.net

Thanks,

(in reply to bphilhower)
Post #: 3
RE: Logon Script To Attach To A Server Based On IP Address - 6/19/2005 1:36:49 PM   
sealeopard

 

Posts: 747
Joined: 12/17/2002
Status: offline
You coudln't get this to work because the posted script is KiXtart, and not a batch file.

(in reply to tuxhoover)
Post #: 4
RE: Logon Script To Attach To A Server Based On IP Address - 6/21/2005 9:55:48 AM   
tuxhoover

 

Posts: 4
Joined: 6/16/2005
Status: offline
Is it possible to write this as a batch file and not kiktart?

(in reply to tuxhoover)
Post #: 5
RE: Logon Script To Attach To A Server Based On IP Address - 6/21/2005 7:27:49 PM   
sealeopard

 

Posts: 747
Joined: 12/17/2002
Status: offline
Use IPCONFIG to get the IP Address then use FIND to see whether the IP Address line contains your desired first three octets.

(in reply to tuxhoover)
Post #: 6
RE: Logon Script To Attach To A Server Based On IP Address - 6/22/2005 2:49:03 PM   
tuxhoover

 

Posts: 4
Joined: 6/16/2005
Status: offline
Yea. I was just wanting to get a Batch file that I can add to my Logon scripts. I'd prefer to use a batch and not kixtart. We're getting ready to buy 3 more stores, and I need the this script to map the backup directory depending on which location they're at.

(in reply to sealeopard)
Post #: 7
RE: Logon Script To Attach To A Server Based On IP Address - 6/22/2005 10:54:12 PM   
sealeopard

 

Posts: 747
Joined: 12/17/2002
Status: offline
IPCONFIG and FIND can be used in batch files.

(in reply to tuxhoover)
Post #: 8
RE: Logon Script To Attach To A Server Based On IP Address - 6/24/2005 11:12:24 AM   
Witto

 

Posts: 187
Joined: 9/28/2004
Status: offline
Dear tuxhoover,
@ECHO OFF
IF EXIST Z: NET USE Z: /DELETE > NUL
IPCONFIG | FIND "10.76.128." > NUL
IF ERRORLEVEL 1 GOTO NotInNet1
NET USE Z: \\server1\%username% > NUL
:NotInNet1
IPCONFIG | FIND "10.76.129." > NUL
IF ERRORLEVEL 1 GOTO NotInNet2
NET USE Z: \\server2\%username% > NUL
:NotInNet2
Maybe you better consider using VBScript or KiXtart like suggested by bphilhower.
If you are willing to pay, I will send you my bank account number .
Kind regards,

< Message edited by Witto -- 6/25/2005 4:36:54 AM >

(in reply to tuxhoover)
Post #: 9
RE: Logon Script To Attach To A Server Based On IP Address - 5/26/2006 9:15:55 AM   
cdban

 

Posts: 1
Joined: 5/26/2006
Status: offline
Thank you very much, we've been chasing our tails on this.

cdban

(in reply to Witto)
Post #: 10
Page:   [1]
All Forums >> [Languages] >> Batch Scripting >> Logon Script To Attach To A Server Based On IP Address Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts



Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.137