Vby
Advanced Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colAdapters = objWMIService.ExecQuery _ ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True") n = 1 text = text + "" For Each objAdapter in colAdapters text = text + "Network Adapter " & n & Chr(10) text = text + "=================" & Chr(10) text = text + " Description: " & objAdapter.Description & Chr(10) text = text + " Physical (MAC) address: " & objAdapter.MACAddress & Chr(10) text = text + " Host name: " & objAdapter.DNSHostName & Chr(10) If Not IsNull(objAdapter.IPAddress) Then For i = 0 To UBound(objAdapter.IPAddress) text = text + " IP address: " & objAdapter.IPAddress(i) & Chr(10) Next End If If Not IsNull(objAdapter.IPSubnet) Then For i = 0 To UBound(objAdapter.IPSubnet) text = text + " Subnet: " & objAdapter.IPSubnet(i) & Chr(10) Next End If If Not IsNull(objAdapter.DefaultIPGateway) Then For i = 0 To UBound(objAdapter.DefaultIPGateway) text = text + " Default gateway: " & _ objAdapter.DefaultIPGateway(i) & Chr(10) Next End If text = text + " DNS" & Chr(10) text = text + " ---" & Chr(10) text = text + " DNS servers in search order:" & Chr(10) If Not IsNull(objAdapter.DNSServerSearchOrder) Then For i = 0 To UBound(objAdapter.DNSServerSearchOrder) text = text + " " & objAdapter.DNSServerSearchOrder(i) & Chr(10) Next End If text = text + " DNS domain: " & objAdapter.DNSDomain & Chr(10) If Not IsNull(objAdapter.DNSDomainSuffixSearchOrder) Then For i = 0 To UBound(objAdapter.DNSDomainSuffixSearchOrder) text = text + " DNS suffix search list: " & _ objAdapter.DNSDomainSuffixSearchOrder(i) & Chr(10) Next End If text = text + " DHCP" & Chr(10) text = text + " ----" & Chr(10) text = text + " DHCP enabled: " & objAdapter.DHCPEnabled & Chr(10) text = text + " DHCP server: " & objAdapter.DHCPServer & Chr(10) If Not IsNull(objAdapter.DHCPLeaseObtained) Then utcLeaseObtained = objAdapter.DHCPLeaseObtained strLeaseObtained = WMIDateStringToDate(utcLeaseObtained) Else strLeaseObtained = "" End If text = text + " DHCP lease obtained: " & strLeaseObtained & Chr(10) If Not IsNull(objAdapter.DHCPLeaseExpires) Then utcLeaseExpires = objAdapter.DHCPLeaseExpires strLeaseExpires = WMIDateStringToDate(utcLeaseExpires) Else strLeaseExpires = "" End If text = text + " DHCP lease expires: " & strLeaseExpires & Chr(10) text = text + " WINS" & Chr(10) text = text + " ----" & Chr(10) text = text + " Primary WINS server: " & objAdapter.WINSPrimaryServer & Chr(10) text = text + " Secondary WINS server: " & objAdapter.WINSSecondaryServer & Chr(10) n = n + 1 Next Function WMIDateStringToDate(utcDate) WMIDateStringToDate = CDate(Mid(utcDate, 5, 2) & "/" & _ Mid(utcDate, 7, 2) & "/" & _ Left(utcDate, 4) & " " & _ Mid (utcDate, 9, 2) & ":" & _ Mid(utcDate, 11, 2) & ":" & _ Mid(utcDate, 13, 2)) End Function Set objEmail = CreateObject("CDO.Message") objEmail.Bodypart.CharSet = "windows-1251" objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "user" objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "pass " objEmail.From = "admin@domain" objEmail.To = "user@domain" objEmail.Subject = "Месага от админа" objEmail.Textbody = text objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp" objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 objEmail.Configuration.Fields.Update objEmail.Send |