#192878 - 2009-03-13 09:31 PM
Re: Subnet / VPN Problem
[Re: Glenn Barnas]
|
aacajo
Fresh Scripter
Registered: 2009-02-13
Posts: 34
Loc: Canada
|
Excuse me for my dumbness but with that NicInfo function how would you do this:
IF NIC=VPN Adapter Skip to local adapter ENDIF
IF DNSSUFFIX = domain.com look at 3rd octet of IP address set 3rd octet to $3rdOctet ELSE exit ENDIF
I'm just not sure how to pull info out of the array as I do not have much experience with using arrays at all...I can just google it if it is too troublesome I keep peppering you guys with these dumb questions! Thanks again!
|
|
Top
|
|
|
|
#192916 - 2009-03-16 04:00 PM
Re: Subnet / VPN Problem
[Re: Glenn Barnas]
|
aacajo
Fresh Scripter
Registered: 2009-02-13
Posts: 34
Loc: Canada
|
Ah good advice looking at the header...lol It makes so much more sense now! Duh...
Now I've tested the UDF for the internal network and an external network. The physical adapter returns the following on 8.
Internal: COMPUTERNAME;domain.com;domain.com External: COMPUTERNAME;;domain.com
I can use the second value to check:
If 2nd value(DNS Suffix) = domain.com
check ip and map printers
Else map network drives and exit.
I'm looking at your UDF and I see the section where you set this value except they all seem to equal $_WorkArray[8] How would I pull the 2nd value out of that? Thanks for tutoring me on my way through this!
|
|
Top
|
|
|
|
#192917 - 2009-03-16 04:38 PM
Re: Subnet / VPN Problem
[Re: aacajo]
|
Glenn Barnas
KiX Supporter
   
Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
|
The header describes the data for element 8 asDomain Info: Hostname;Connection;Primary;Search List **, *** This lists the hostname, the Connection-Specific DNS Domain, the Primary DNS Domain, and the domain-name search list. The first $_WorkArray[8]= line sets the hostname. The next reads a reg value and appends to $_WorkArray[8]. There's a third reference farther on that adds two more values to the list.
This value can be complicated - I could have returned an array of arrays, but this often makes things too complicated.. instead, I chose to return a list that consists of values. You can use $DomainInfo=Split($WorkArray[8], ';') to create an array containing the hostname, connection, primary, and search values. Be aware that the last item - search - can contain multiple domain names, separated by spaces. This would generally not be used to determine domain location or membership. By using this command, you could reference the connection domain as $DomainInfo[1]
The way things should work - if everything is properly configured in the network - is: Computer name is HOSTNAME.PRIMARY_DOMAIN (elements 0 & 2) - UNLESS "connection" is defined. If "Connection" is defined (usually due to two or more active NICs, including a VPN connection) the computer name is HOSTNAME.CONNECTION_DOMAIN when communicating through the specific connection. Thus, a computer could have multiple identities in a complex network. The last field - Search List - is used when the local computer tries to identify non-qualified hostnames.. for example, if you "PING THATHOST", it first appends the primary domain or connection-specific domain if appropriate to the outbound interface.. if there's no reply, it appends each of the domain names in the search list until it gets a reply or gives up.
This illustrates why the data returns different values for internal and external in your example.. the external does not have a connection-specific domain defined, only a primary domain.
Glenn
_________________________
Actually I am a Rocket Scientist!
|
|
Top
|
|
|
|
#192926 - 2009-03-16 08:04 PM
Re: Subnet / VPN Problem
[Re: Glenn Barnas]
|
aacajo
Fresh Scripter
Registered: 2009-02-13
Posts: 34
Loc: Canada
|
Awesome this should work...so close I can taste it!
Getting a comma return error with $DomainInfo=Split($_WorkArray[8]';')
I added $DomainInfo=Split($_WorkArray[8],';') and I'm still getting the same error. Something I need to look at with syntax? This appears correct to me..
|
|
Top
|
|
|
|
#192946 - 2009-03-17 04:57 PM
Re: Subnet / VPN Problem
[Re: Glenn Barnas]
|
aacajo
Fresh Scripter
Registered: 2009-02-13
Posts: 34
Loc: Canada
|
How would I send the output of your function in to an array out side of the function? Like for the return values such as 0-19 in the list would be assigned to $array[0] through $array[19]?
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 874 anonymous users online.
|
|
|