realkiller Posted October 23, 2007 Share Posted October 23, 2007 is there a way to retreive a mac adddres with a ldap request? if yes is there a script Remote 3.1 BetaRemote Media Player ControlUSB Security 1.2 Link to comment Share on other sites More sharing options...
ptrex Posted October 23, 2007 Share Posted October 23, 2007 realkiller, As far as I know this is not possible directly. Becuse LDAP accesses the AD properties in a domain. And a MAC address is not stored there. You can write a script to list computers in an OU and than Query the MAC address through WMI. So indirectly it would be possible though. Regards ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
realkiller Posted October 23, 2007 Author Share Posted October 23, 2007 i think i found a VB script can anyone convert it 2 autoit expandcollapse popupSet Shell = Wscript.CreateObject("WScript.Shell") Set File = CreateObject("Scripting.FileSystemObject") On Error Resume Next set Dom = getobject("WinNT://YOURDOMAIN") Dom.Filter = array("computer") avail = false for each item in Dom ping item.Name,avail if avail = true then maclist item.Name next wscript.echo "MAC address capture complete..." wscript.quit '--- 'appends PC name and MAC address to macaddr.txt Function macList(RemotePC) Set IPConfigSet = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & RemotePC & "\root\cimv2" ).ExecQuery ("SELECT MACAddress FROM Win32_NetworkAdapterConfiguration " & "WHERE IPEnabled=true" ) For Each IPConfig In IPConfigSet custom = RemotePC & vbTab & IPConfig.MACAddress & vbNewLine Next createTempfile custom fileAppend File.OpenTextFile ("c:\temp.txt"), File.OpenTextFile ("c:\macaddr.txt", 8) File.DeleteFile "c:\temp.txt", true End Function '--- 'This function appends one file to another Function fileAppend(source,destination) Do While source.AtEndOfline <> true destination.WriteLine(source.readline) Loop source.close destination.close End Function '--- 'creates a txt file called temp.txt and write's data from dat to it Function createTempfile(dat) Set temp = File.CreateTextFile("c:\temp.txt") temp.WriteLine dat temp.Close End Function '--- 'pings a client Function ping (RemotePC,avail) Set objPing = GetObject("winmgmts:{impersonationLevel=impersonat e}").ExecQuery("select * from Win32_PingStatus where address = '" & RemotePC & "'") For Each objStatus in objPing If IsNull(objStatus.StatusCode) or objStatus.StatusCode<>0 Then avail = false Else avail = true End If Next End Function Remote 3.1 BetaRemote Media Player ControlUSB Security 1.2 Link to comment Share on other sites More sharing options...
ptrex Posted October 23, 2007 Share Posted October 23, 2007 @realkiller I am not sure if this will do it. expandcollapse popup#include <array.au3> $Shell = Objcreate("WScript.Shell") $File = ObjCreate("Scripting.FileSystemObject") $Dom = ObjGet("WinNT://YOURDOMAIN") $Dom.Filter = _ArrayCreate("computer") $avail = 0 For $item in $Dom ping ($item.Name,$avail) if $avail = 1 then maclist $item.Name next ConsoleWrite ("MAC address capture complete...") Exit ;--- ;appends PC name and MAC address to macaddr.txt Func macList($RemotePC) $IPConfigSet = ObjGet("winmgmts:" & "{impersonationLevel=impersonate}!\\" & _ $RemotePC & "\root\cimv2" ).ExecQuery ("SELECT MACAddress FROM Win32_NetworkAdapterConfiguration " & "WHERE IPEnabled=true" ) For $IPConfig In $IPConfigSet $custom = $RemotePC & @TAB & $IPConfig.MACAddress & $vbNewLine Next createTempfile ($custom) fileAppend ($File.OpenTextFile ("c:\temp.txt"), $File.OpenTextFile ("c:\macaddr.txt", 8)) $File.DeleteFile ("c:\temp.txt", 1) EndFunc ;--- ;This function appends one $File to another Func fileAppend($source,$destination) While $source.AtEndOfline (<> 1) $destination.WriteLine($source.readline) Wend $source.close() $destination.close() EndFunc ;--- ;creates a txt $File called $temp.txt and write;s data from $dat to it Func createTempfile($dat) $temp = $File.CreateTextFile("c:\temp.txt") $temp.WriteLine ($dat) $temp.Close() EndFunc ;--- ;pings a client Func ping ($RemotePC,$avail) $objPing = ObjGet("winmgmts:{impersonationLevel=impersonat e}").ExecQuery("select * from Win32_PingStatus where address = '" & $RemotePC & "'") For $objStatus in $objPing If not IsObj($objStatus.StatusCode) or $objStatus.StatusCode<>0 Then $avail = 0 Else $avail = 1 EndIf Next EndFunc Regards ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
realkiller Posted October 25, 2007 Author Share Posted October 25, 2007 the script doesnt function Remote 3.1 BetaRemote Media Player ControlUSB Security 1.2 Link to comment Share on other sites More sharing options...
ptrex Posted October 25, 2007 Share Posted October 25, 2007 (edited) @RealKiller Sorry for not testing it !! I only did a quick translation. This runs without errors (still not tested) expandcollapse popup#include <array.au3> $Shell = Objcreate("WScript.Shell") $File = ObjCreate("Scripting.FileSystemObject") $Dom = ObjGet("WinNT://DOMAIN") $Dom.Filter = _ArrayCreate("computer") $avail = 0 For $item in $Dom _Ping ($item.Name,$avail) if $avail = 1 then maclist ($item.Name) next ConsoleWrite ("MAC address capture complete...") Exit ;appends PC name and MAC address to macaddr.txt Func macList($RemotePC) $IPConfigSet = ObjGet("winmgmts:" & "{impersonationLevel=impersonate}!\\" & $RemotePC & "\root\cimv2") $IPConfigs = $IPConfigSet.ExecQuery ("SELECT MACAddress FROM Win32_NetworkAdapterConfiguration " & "WHERE IPEnabled=true" ) For $IPConfig In $IPConfigs $custom = $RemotePC & @TAB & $IPConfig.MACAddress & @CRLF Next createTempfile ($custom) fileAppend ($File.OpenTextFile ("c:\temp.txt"), $File.OpenTextFile ("c:\macaddr.txt", 8)) $File.DeleteFile ("c:\temp.txt", 1) EndFunc ;This function appends one $File to another Func fileAppend($source,$destination) While $source.AtEndOfline <> 1 $destination.WriteLine($source.readline) Wend $source.close() $destination.close() EndFunc ;creates a txt $File called $temp.txt and write;s data from $dat to it Func createTempfile($dat) $temp = $File.CreateTextFile("c:\temp.txt") $temp.WriteLine ($dat) $temp.Close() EndFunc ;pings a client Func _Ping ($RemotePC,$avail) $objPing = ObjGet("winmgmts:{impersonationLevel=impersonate}") $Result = $objPing.ExecQuery("select * from Win32_PingStatus where address = '" & $RemotePC & "'") For $objStatus in $Result If not IsObj($objStatus.StatusCode) or $objStatus.StatusCode<>0 Then $avail = 0 Else $avail = 1 EndIf Next EndFunc regards, ptrex Edited October 25, 2007 by ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
realkiller Posted October 26, 2007 Author Share Posted October 26, 2007 it doesnt give me a error but it doesnt run ether anyone else got a difrent script 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