#167091 - 2006-09-08 02:48 PM
Re: Remote IP-Address
|
Witto
MM club member
   
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
|
|
Top
|
|
|
|
#167093 - 2006-09-08 05:25 PM
Re: Remote IP-Address
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4567
Loc: USA
|
Using EnumNetworkConnections() and GetIPOptions() should work.
The example below is from the GetIPOptions() header. It should get you started in the right direction.
Code:
break on $remotepc="computername" for each $nc in Enumnetworkconnections(3,$remotepc) $ConnectionName=split($nc,",")[0] $MACAddress=split($nc,",")[1] $AdapterName=split($nc,",")[2] ? " Connection Name: " + $connectionname ? " MACAddress: " + $MACAddress ? " Adapter Name: " + $AdapterName ? " Mac Address: " + getipoptions("Macaddress",$remotepc,$macaddress) ? " Static Address: " + getipoptions("StaticIP",$remotepc,$macaddress) ? " DHCP Enabled: " + getipoptions("DHCPEnabled",$remotepc,$macaddress) ? " IPaddress/SM: " + getipoptions("IPAddress",$remotepc,$macaddress) ? " IPaddress0/SM: " + getipoptions("IPAddress0",$remotepc,$macaddress) ? " IPaddress1/SM: " + getipoptions("IPAddress1",$remotepc,$macaddress) ? " IPaddress2/SM: " + getipoptions("IPAddress2",$remotepc,$macaddress) ? " IPaddress3/SM: " + getipoptions("IPAddress3",$remotepc,$macaddress) ? " DefaultGW: " + getipoptions("DefaultGW",$remotepc,$macaddress) ? " DNS Servers: " + getipoptions("DNSServers",$remotepc,$macaddress) ? " WINS Servers: " + getipoptions("WINSServers",$remotepc,$macaddress) ? " DNSSuffix: " + getipoptions("DNSDomain",$remotepc,$macaddress) ? " DNS Search Order: " + getipoptions("DNSDomainSuffixSearchOrder",$remotepc,$macaddress) ? " DHCP Server: " + getipoptions("DHCPServer",$remotepc,$macaddress) ? "DHCP Lease Obtained: " + getipoptions("DHCPLeaseObtained",$remotepc,$macaddress) ? " DHCP Lease Expires: " + getipoptions("DHCPLeaseExpires",$remotepc,$macaddress) ? "---------------" next
|
|
Top
|
|
|
|
#167096 - 2006-09-11 02:19 PM
Re: Remote IP-Address
|
private_meta
Getting the hang of it
Registered: 2006-07-27
Posts: 80
Loc: Austria
|
The Script runs on a Win2k-Workstation.
I've solved the problem, though it might be a bit rough as i'm not that able to hand back a multidimensional array (maybe you can help there)
Code:
;FUNCTION NetViewSH() ; ;ACTION Gets Computernames, Descriptions and IPs from a network without WMI-Usage ; ;VERSION 0.9 ; ;KIXTART VER 4.53 ; ;AUTHOR Andreas "private_meta" ; ;SYNTAX $ = NetViewSH("Domain") ; ;PARAMETERS Domain ; Domain Name for a network, optional ; ;RETURN Nothing ; ;REMARKS none ; ;DEPENDENCIES working network ;) ; ;EXAMPLE ; NetViewSH() ; FOR $i = 1 TO UBOUND($net_names) ; $net_names[$i] + " " + $net_descr[$i] + " " + $net_ips[$i] ? ; NEXT ; ;KIXTART BBS none yet ;) ;
Function NetViewSH(optional $domain) GLOBAL $net_names[255] GLOBAL $net_descr[255] GLOBAL $net_ips[255] DIM $REDIM $REDIM = 255 DIM $i $i = 0 DIM $j $j = 0 DIM $tempfile $tempfile = "%temp%\netview2.pmt" DIM $tempfile1 $tempfile1 = "%temp%\netview3.pmt" IF $domain $domain = "/domain:$domain" ENDIF IF Exist($tempfile) DEL $tempfile ENDIF SHELL '%comspec% /c net view $domain >"$tempfile"' IF @error = 0 IF Open(10,$tempfile) = 0 DO $line = ReadLine(10) ; skip header UNTIL SUBSTR($line,1,2) = "\\" WHILE @error = 0 $net_names[$i] = RTrim(SubStr($line,3,InStr($line," ")-1)) $net_descr[$i] = LTrim(RTrim(SubStr($line,19,60))) SHELL "%comspec% /c ping -n 1 " + $net_names[$i] + " > " + "$tempfile1" IF Open(9,$tempfile1) = 0 DO $line1 = ReadLine(9) UNTIL SUBSTR($line1,1,4) = "Ping" OR @ERROR=-1 IF @ERROR=-1 $net_ips[$i] = "0.0.0.0" ELSE $net_ips[$i] = SPLIT(SPLIT($line1,"[")[1],"]")[0] ENDIF ENDIF $x=CLOSE(9) $i=$i+1 IF $i = $REDIM $REDIM=$REDIM*2 REDIM $net_names[$REDIM] ENDIF $line = ReadLine(10) Loop $x=Close(10) DEL $tempfile DEL $tempfile1 IF $i REDIM preserve $net_names[$i-4] ;$netview = $net_names EXIT @error ENDIF FOR EACH $item IN $net_names $item ? NEXT ENDIF ENDIF ;$netview = $net_names EXIT @error ENDFUNCTION
Edited by private_meta (2006-09-13 12:07 PM)
_________________________
-=If you absolutly believe you can make up talent with hard work, there is no limit to what you can't achieve.=-
|
|
Top
|
|
|
|
#167099 - 2006-09-12 08:28 AM
Re: Remote IP-Address
|
Witto
MM club member
   
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
Doc, I would not promote the habit to use vars like $ReDim either, but it seems to work: Code:
If NOT @LOGONMODE Break On EndIf Dim $SO $SO = SetOption("Explicit","On") $SO = SetOption("NoMacrosInStrings","On") $SO = SetOption("NoVarsInStrings","On") $SO = SetOption("WrapAtEOL","On")
Dim $ReDim[2] $ReDim = Split("a,b,c",",") ReDim Preserve $ReDim[3] $ReDim[3] = "d" For Each $SO In $ReDim ? $SO Next ? "KiX Version: " + @KIX ? "KiX Executable: " @SCRIPTEXE
Output on screen Code:
a b c d KiX Version: 4.53 Release Candidate 1 KiX Executable: KIX32.EXE
|
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
1 registered
(Allen)
and 675 anonymous users online.
|
|
|