realkiller Posted September 27, 2007 Share Posted September 27, 2007 is it possible to get only the requested mac addres, if i use this i get a hole list and the mac addres. i only wanna have the mac adderes number: 00ABCDEF0000 RunWait(@ComSpec & " /c nbtstat -a up443>"&Chr(34)&"C:\mac.txt"&Chr(34),"",@SW_HIDE) Remote 3.1 BetaRemote Media Player ControlUSB Security 1.2 Link to comment Share on other sites More sharing options...
BrettF Posted September 27, 2007 Share Posted September 27, 2007 Have a look at the way Ibrahim does it here.You should be able to work something out from that... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
realkiller Posted September 27, 2007 Author Share Posted September 27, 2007 that wont work if you have more subnets thatswhy i use a netbios request Remote 3.1 BetaRemote Media Player ControlUSB Security 1.2 Link to comment Share on other sites More sharing options...
BrettF Posted September 27, 2007 Share Posted September 27, 2007 (edited) that wont work if you have more subnets thatswhy i use a netbios requestYou could: #include <array.au3> #include <Constants.au3> Dim $line $foo = Run(@ComSpec & " /c nbtstat -a ", "",@SW_Hide, $STDOUT_CHILD) $count = 1 While 1 $line &= StdoutRead($foo) & @CRLF If @error Then ExitLoop $count +=1 Wend MsgBox (0, "", $line) I still don't get the MAC Address with the CMD... EDIT: Missed a bit... Edited September 27, 2007 by Bert Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
realkiller Posted September 27, 2007 Author Share Posted September 27, 2007 (edited) if i use that i get the mac addres, and more information, i only wanna have the mac address number is that possible? LAN-Verbindung: Knoten-IP-Adresse: [172.29.28.138] Bereichskennung: [] NetBIOS-Namentabelle des Remotecomputers Name Typ Status --------------------------------------------- UP443 <00> EINDEUTIG Registriert UP443 <20> EINDEUTIG Registriert UP443 <03> EINDEUTIG Registriert up543 <03> EINDEUTIG Registriert MAC Adresse = 00-0F-1F-E3-6F-43 Edited September 27, 2007 by realkiller Remote 3.1 BetaRemote Media Player ControlUSB Security 1.2 Link to comment Share on other sites More sharing options...
BrettF Posted September 27, 2007 Share Posted September 27, 2007 This should show you how it is done. And it should get you on your merry way #include <array.au3> $output = "LAN-Verbindung:" & @LF & _ "Knoten-IP-Adresse: [172.29.28.138] Bereichskennung: []" & @LF & _ @LF & _ @LF & _ @LF & _ "NetBIOS-Namentabelle des Remotecomputers" & @LF & _ @LF & _ @LF & _ @LF & _ "Name Typ Status" & @LF & _ @LF & _ "---------------------------------------------" & @LF & _ @LF & _ "UP443 <00> EINDEUTIG Registriert" & @LF & _ "UP443 <20> EINDEUTIG Registriert" & @LF & _ "UP443 <03> EINDEUTIG Registriert" & @LF & _ @LF & _ "up543 <03> EINDEUTIG Registriert" & @LF & _ @LF & _ @LF & _ @LF & _ "MAC Adresse = 00-0F-1F-E3-6F-43" & @LF MsgBox (0, "Before Strip all @LF", $output) $output2 = StringReplace ($output, @LF, "") MsgBox (0, "After Strip all @LF", $output2) $output3 = StringSplit ($output2, "MAC Adresse", 1) _ArrayDisplay ($output3) $mac = StringReplace ($output3[2], "-", "") $mac = StringReplace ($mac, "=", "") $mac = StringReplace ($mac, " ", "") MsgBox (0, "MAC Address", $mac) Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
realkiller Posted September 27, 2007 Author Share Posted September 27, 2007 the problem is it change at every workstation sow i made this but it doesn't filter everything, i need only the mac number $ip = "up443" #include <Constants.au3> Dim $line $foo = Run(@ComSpec & " /c nbtstat -a "&$ip, "",@SW_Hide, $STDOUT_CHILD) $count = 1 While 1 $line &= StdoutRead($foo) & @CRLF If @error Then ExitLoop $count +=1 Wend $output2 = StringReplace ($line, @LF, $line) $output3 = StringSplit ($output2, "MAC Adresse", 1) $mac = StringReplace ($output3[2], "-", "") $mac = StringReplace ($mac, "=", "") $mac = StringReplace ($mac, " ", "") MsgBox (0, "MAC Address", $mac) Remote 3.1 BetaRemote Media Player ControlUSB Security 1.2 Link to comment Share on other sites More sharing options...
realkiller Posted September 27, 2007 Author Share Posted September 27, 2007 anyone? Remote 3.1 BetaRemote Media Player ControlUSB Security 1.2 Link to comment Share on other sites More sharing options...
SkinnyWhiteGuy Posted September 27, 2007 Share Posted September 27, 2007 (edited) Local $arComputers[3] = ["Lab-4", "Lab-5", "Lab-6"] For $strComputer In $arComputers $line = '' $PID = Run(@ComSpec & " /c nbtstat -a " & $strComputer,@SystemDir, @SW_HIDE, 2) While Not @error $line &= StdoutRead($PID) WEnd If StringInStr($line, "MAC Address = ") Then $Mac = StringMid($line, StringInStr($line, "MAC Address = ")+StrLen("MAC Address = "),17) MsgBox(0, $strComputer, $Mac) Else MsgBox(0, $strComputer, "Host Offline") EndIf Next Just make sure you put the computer names you wish to see the Mac addresses for in the beginning array, and this should show a MsgBox of their MAC addresses, if they're online. Also make sure to change the "MAC Addresss = " in all three places to match what language Windows you have, and all should work out. Edited September 27, 2007 by SkinnyWhiteGuy Link to comment Share on other sites More sharing options...
realkiller Posted September 28, 2007 Author Share Posted September 28, 2007 first off all thx all for responding if i compile your script i get a compile error ERROR: StrLen(): undefined function. $Mac = StringMid($line, StringInStr($line, "MAC Address = ")+StrLen("MAC Address = ") Remote 3.1 BetaRemote Media Player ControlUSB Security 1.2 Link to comment Share on other sites More sharing options...
BrettF Posted September 28, 2007 Share Posted September 28, 2007 Change the line to $Mac = StringMid($line, StringInStr($line, "MAC Address = ")+StringLen("MAC Address = ") Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
realkiller Posted September 28, 2007 Author Share Posted September 28, 2007 The scripts works half the code is correct but it still doesn't show me a mac addres:( Local $arComputers[3] = ["up443", "up579", "up125"] For $strComputer In $arComputers $line = '' $PID = Run(@ComSpec & " /c nbtstat -a " & $strComputer,@SystemDir, @SW_HIDE, 2) While Not @error $line &= StdoutRead($PID) WEnd If StringInStr($line, "MAC Address = ") Then $Mac = StringMid($line, StringInStr($line, "MAC Address = ")+StringLen("MAC Address = "),17) MsgBox(0, $strComputer, $Mac) Else MsgBox(0, $strComputer, "Host Offline") EndIf Next Remote 3.1 BetaRemote Media Player ControlUSB Security 1.2 Link to comment Share on other sites More sharing options...
realkiller Posted September 28, 2007 Author Share Posted September 28, 2007 The scripts works half the code is correct but it still doesn't show me a mac addres:( Local $arComputers[3] = ["up443", "up579", "up125"] For $strComputer In $arComputers $line = '' $PID = Run(@ComSpec & " /c nbtstat -a " & $strComputer,@SystemDir, @SW_HIDE, 2) While Not @error $line &= StdoutRead($PID) WEnd If StringInStr($line, "MAC Address = ") Then $Mac = StringMid($line, StringInStr($line, "MAC Address = ")+StringLen("MAC Address = "),17) MsgBox(0, $strComputer, $Mac) Else MsgBox(0, $strComputer, "Host Offline") EndIf Next Remote 3.1 BetaRemote Media Player ControlUSB Security 1.2 Link to comment Share on other sites More sharing options...
realkiller Posted September 28, 2007 Author Share Posted September 28, 2007 (edited) found it thx everyone:D Edited September 28, 2007 by realkiller Remote 3.1 BetaRemote Media Player ControlUSB Security 1.2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now