MartyConnelly
martyconnelly at shaw.ca
Thu Jun 29 12:58:56 CDT 2006
You could try using WMI , it takes about 5 to 10 seconds to run on first pass to start WMI. WMI can also look deeper on an NIC and get speed, error count etc but depends on Vendor. Here are about 400 sample WMI scripts. http://www.activexperts.com/activmonitor/windowsmanagement/scripts/ most WMI work is done by Network Nabobs and done in VBS script. So you will have to hunt around scripting sites. When debugging WMI turn on and off 'On Error Resume Next It will help you find variables that are returned as either arrays or strings If you dont have full documentaion. You can run this over a domain if you have a table of machine names or obtain them from ADSI Sub listMACS() Dim objWMIService As Object Dim colItems As Object Dim objItem As Object Dim strComputer As String Dim count As Long Dim i As Long Dim IPAddress As String Dim NetworkMAC As String 'On Error Resume Next strComputer = "." 'local default machine name count = 0 Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration ", , 48) For Each objItem In colItems count = count + 1 If count = 1 Then Debug.Print "Net DHCPEnabled: " & objItem.DHCPEnabled If Not IsNull(objItem.IPAddress) Then For i = LBound(objItem.IPAddress) To UBound(objItem.IPAddress) Debug.Print "IP address: " & objItem.IPAddress(i) IPAddress = objItem.IPAddress(i) Next End If Debug.Print "Net MAC Address: " & objItem.MACAddress NetworkMAC = objItem.MACAddress Else End If Next End Sub or a different method Sub testnicconfigS() 'may need to set reference to WMI for WinXP and 2000 'The Win32_NetworkAdapterConfiguration WMI class represents 'the attributes and behaviors of a network adapter. 'This class has been extended to include extra properties and methods 'that support the management of the TCP/IP and Internetworking Packet Exchange (IPX) 'protocols (and are independent of the network adapter). Dim strComputer As String Dim objWMIService As Object Dim colitems As Object Dim objitem As Object On Error Resume Next 'there maybe multiple Nic entries that are empty so skip them strComputer = "." 'default "." specifies local machine name Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colitems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration", , 48) For Each objitem In colitems Debug.Print "DHCPEnabled: " & objitem.DHCPEnabled Debug.Print "DHCPLeaseExpires: " & WMIDateStringToDate (objitem.DHCPLeaseExpires) Debug.Print "DHCPLeaseObtained: " & WMIDateStringToDate (objitem.DHCPLeaseObtained) Debug.Print "DHCPServer: " & objitem.DHCPServer Debug.Print "DNSDomain: " & objitem.DNSDomain Debug.Print "DNSHostName: " & objitem.DNSHostName Debug.Print "DomainDNSRegistrationEnabled: " & objitem.DomainDNSRegistrationEnabled Debug.Print "IPAddress: " & objitem.IPAddress(0) 'this is an array like other undocumented entries 'you will have to find by trial and error 'although there is an isarray property somewhere Debug.Print "IPAddresslen: " & Len(objitem.IPAddress(0)) Debug.Print "IPConnectionMetric: " & objitem.IPConnectionMetric Debug.Print "IPEnabled: " & objitem.IPEnabled Debug.Print "MACAddress: " & objitem.MACAddress Debug.Print "MTU: " & objitem.MTU Next End Sub Function WMIDateStringToDate(dtmInstallDate) As String 'WMI has an odd date format WMIDateStringToDate = CDate(Mid(dtmInstallDate, 5, 2) & "/" & _ Mid(dtmInstallDate, 7, 2) & "/" & Left(dtmInstallDate, 4) _ & " " & Mid(dtmInstallDate, 9, 2) & ":" & _ Mid(dtmInstallDate, 11, 2) & ":" & Mid(dtmInstallDate, _ 13, 2)) End Function Darren DICK wrote: >Hi Gustav > >I think that was it > >But when I run it - Access dies and Microsoft kindly offers me the opportunity >the send them a report about the death or not - I Choose NO > >I vaguely remember having to change one tiny tiny bit of code from a zero to a 1 >or vice versa - can't remember - thanks for the link > >See ya > >Have a great day > >Darren >------------------ >T: 0424 696 433 > >-----Original Message----- >From: accessd-bounces at databaseadvisors.com >[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock >Sent: Thursday, 29 June 2006 11:35 PM >To: accessd at databaseadvisors.com >Subject: Re: [AccessD] A2000: IP Address/es List > >Hi Darren > >Could it be this from Robert: > >http://databaseadvisors.com/pipermail/accessd/2004-January/018242.html > >/gustav > > > >>>>darrend at nimble.com.au 29-06-2006 14:36:37 >>> >>>> >>>> >Hi All > >A long time ago (2 or 3 hard disk formats ago) I had a nifty bit of code that >iterated through all the nics etc and returned a list of all the IP Address/es >for a machine > >Anyone know where I can get my hands on it again?? > >Many thanks - In advance > >Have a great day y'all > >Darren > > > -- Marty Connelly Victoria, B.C. Canada