Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: WMI Get MAC Address and NIC info
strComputer = "." objWMIService = GetObject(StrCat("winmgmts:!\\" , strComputer , "\root\cimv2")) colAdapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter") ForEach objAdapter In colAdapters AdapterType = objAdapter.AdapterType Caption = objAdapter.Caption Manufacturer = objAdapter.Manufacturer MACAddress = objAdapter.MACAddress Status = objAdapter.Status Name = objAdapter.Name PermanentAddress = objAdapter.PermanentAddress Line = StrCat("AdapterType: ",AdapterType ,@CRLF,"Caption: ",Caption ,@CRLF,"Manufacturer: ",Manufacturer,@CRLF,"MACAddress: ",MACAddress,@CRLF) Line = StrCat(Line,"Name: ",Name,@CRLF,"Status: ",Status,@CRLF) Message("",Line) Next
Sample 2 (old way):
ComputerName = ""; or "Peanuts" Locator = ObjectOpen("WbemScripting.SWbemLocator") Service = Locator.ConnectServer(ComputerName) Security = Service.Security_ Security.ImpersonationLevel = 3 Adapters = Service.InstancesOf("Win32_NetworkAdapter") hEnum = ObjectCollectionOpen(Adapters) swNameList="" While 1 Nic = ObjectCollectionNext(hEnum) If Nic == 0 Then Break AdapterType = Nic.AdapterType Caption = Nic.Caption Manufacturer = Nic.Manufacturer MACAddress = Nic.MACAddress Status = Nic.Status ; Name = Nic.Name ; PermanentAddress = Nic.PermanentAddress ; Line = StrCat("AdapterType: ",AdapterType ,@crlf,"Caption: ",Caption ,@crlf,"Manufacturer: ",Manufacturer,@crlf,"MACAddress: ",MACAddress,@crlf) Line = StrCat(Line,"Name: ",Name,@crlf,"Status: ",Status,@crlf) Message("",Line) ObjectClose(Nic) EndWhile ObjectCollectionClose(hEnum) ObjectClose(Adapters) ObjectClose(Security) ObjectClose(Service) ObjectClose(Locator)
Article ID: W15793
File Created: 2012:03:15:13:53:48
Last Updated: 2012:03:15:13:53:48