#116746 - 2004-03-24 06:00 PM
Looking for 3 letters in the hostname
|
Shaggydog
Fresh Scripter
Registered: 2003-05-20
Posts: 31
Loc: Mississauga, ON
|
Hi, The code I'm working on will check to see if the word MOB appears in the hostname. ie: WMOB1 or TYMOB2 etc...
So far this is what I've done.
$mobile=(@substr(@wksta,-4,3)
My understanding of the syntax may be my error. I believe that the -4 means it's 4 characters from the back and then 3 characters long.
Would it be so simple as to just do this though?
$mobile=@wksta if $mobile="*MOB*" blah blah blah end if
? Thanks in advance for your help
|
|
Top
|
|
|
|
#116748 - 2004-03-24 06:06 PM
Re: Looking for 3 letters in the hostname
|
Shaggydog
Fresh Scripter
Registered: 2003-05-20
Posts: 31
Loc: Mississauga, ON
|
Thanks, I'll try it.
I appreciate how quick you responded.
|
|
Top
|
|
|
|
#116751 - 2004-03-31 05:33 PM
One last thing
|
Shaggydog
Fresh Scripter
Registered: 2003-05-20
Posts: 31
Loc: Mississauga, ON
|
Thanks for your help. The other complication I've run across is the step I was hoping to do in the If statement.
i want to map drives by IP, but I've discovered that by looking at the manual that the "use" doesn't do this.
I've tried a search, but it didn't clear up the issue.
Any UDF's that I could use for this?
Thanks
|
|
Top
|
|
|
|
#116753 - 2004-03-31 09:20 PM
Mapping Drives by IP
|
Shaggydog
Fresh Scripter
Registered: 2003-05-20
Posts: 31
Loc: Mississauga, ON
|
Thanks.
I'm still struggling to get this to work properly, but I'm imaging that I must've missed a step.
There wasn't anything in that primer that mapped drives by IP, but i saw how ip information can be held in variables.
I tried this.
$ip='192.168.1.1' use F: "\\$ip\Users"
At this point it hasn't worked. I figure I'm doing something fundamentally wrong.
|
|
Top
|
|
|
|
#116754 - 2004-03-31 09:44 PM
Re: Mapping Drives by IP
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Can I ask a silly question? Why are you mapping a drive to the same client?
Anyway, here is the code.. Code:
CLS BREAK ON $1st=TRIM(SPLIT(@IPADDRESS0,'.')[0]) $2nd=TRIM(SPLIT(@IPADDRESS0,'.')[1]) $3rd=TRIM(SPLIT(@IPADDRESS0,'.')[2]) $4th=TRIM(SPLIT(@IPADDRESS0,'.')[3]) ?$1st ?$2nd ?$3rd ?$4th
IF $1st+'.'+$2nd = '192.168' use F: '\\'+ $1st+'.'+$2nd+'.'+$3rd+'.'+$4th+'\Users' ENDIF ? ?'Press a key..' GET $k
HTH,
Kent
|
|
Top
|
|
|
|
#116755 - 2004-03-31 09:48 PM
Re: Mapping Drives by IP
|
Shaggydog
Fresh Scripter
Registered: 2003-05-20
Posts: 31
Loc: Mississauga, ON
|
I'm not trying to map to a folder on the same client.
I'm trying to map to a folder on the server, but when our laptops connect via VPN we can't reach drive mappings created by using host name.
Use F: "\\server\share" works fine when connected by through the VPN it fails.
The server IP is 192.168.1.100, and I know windows can do drive mapping this way, I'd like to set it up using the script.
|
|
Top
|
|
|
|
#116757 - 2004-03-31 10:16 PM
Re: Mapping Drives by IP
|
Shaggydog
Fresh Scripter
Registered: 2003-05-20
Posts: 31
Loc: Mississauga, ON
|
I'm not trying to decide which IP gets what printer.
I am trying to create drive maps using the IP instead of the host name. use F: "\\server\share" replaced with something that effectively does this. Use F: "\\192.168.1.100\share"
Across our VPN drive maps created using hostnames do not work. Drive maps created using IP's do.
I already know the exact IP's i would like to map.
|
|
Top
|
|
|
|
#116761 - 2004-04-01 05:05 PM
Re: Mapping Drives by IP
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Some rambling thoughts...
When you are running VPN over the Internet, you have two possible sources for DNS, the ISPs DNS and your own internal corporate DNS server.
Now, in the "Advanced" tab of the TCP/IP properties you may add a number of DNS servers.
If you have two different server addresses and the first responds with an authoratitave NXDOMAIN because the address is invalid, does it use the next server? Or are the additional servers used only as backup in case the primary server does not respond?
Usually, you can only have one DNS server responding, and you need to make a decision whether that is the ISP's DNS server, or your internal DNS server. Either way the other may be inaccessible.
To get around this, your internal DNS server is normally configured to forward lookup requests for domains that it does not manage to an external DNS server.
If your VPN connection software promotes your internal DNS server when you make a connection (and drops it out again afterwards) and you have DNS forwarding configured on the internal server then it should all work fine.
If your internal DNS server doesn't forward requests then it is more problematical.
You don't want your internal name server as the primary when your VPN is inactive as name resolution will try to use it.
WINS is not such a problem, as you are likely to only ever need your own internal WINS server.
|
|
Top
|
|
|
|
#116762 - 2004-04-01 06:06 PM
Re: Mapping Drives by IP
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
What VPN are you using?
Kent
|
|
Top
|
|
|
|
#116763 - 2004-04-01 06:44 PM
Re: Mapping Drives by IP
|
Shaggydog
Fresh Scripter
Registered: 2003-05-20
Posts: 31
Loc: Mississauga, ON
|
Our VPN is set up using Cisco routers across the different connections. My laptop here on the LAN itself has no problem with it's mapped drives and of course creating new ones weither by IP or hostname. When I take it home and use the cisco utility to connect to our work VPN, all the drive mappings I've created here at work, work fine when, but if I try to create new ones I need to do so by IP.
At any rate guys, I took this issue back to my General Manager and pointed out to him that no one aside from me and a few others will be drive mapping while at home anyways.
Jens, Kdyer and Richard, thanks for your patience and great advice. I apologize for monopolizing any time.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 519 anonymous users online.
|
|
|