awsswaawsswa
Junior Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору ' Vbs Script To Document Your Servers Network Adapter IP Information ' скрипту требуется список компьюторов в файле MachineList.Txt Set objExcel = CreateObject("Excel.Application") objExcel.Visible = True objExcel.Workbooks.Add intRow = 2 objExcel.Cells(1, 1).Value = "Machine Name" objExcel.Cells(1, 2).Value = "IP Address" objExcel.Cells(1, 3).Value = "Subnet Mask" objExcel.Cells(1, 4).Value = "Default Gateway" objExcel.Cells(1, 5).Value = "MAC Address" Set Fso = CreateObject("Scripting.FileSystemObject") Set InputFile = fso.OpenTextFile("MachineList.Txt") Do While Not (InputFile.atEndOfStream) strComputer = InputFile.ReadLine Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CimV2") Set colItems = objWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IpEnabled = True") For Each objItem in colItems strIpAddress = Join(objItem.IpAddress) strIpSubnet = Join(objItem.IpSubnet) strDefaultGateway = Join(objItem.DefaultIpGateway) objExcel.Cells(intRow, 1).Value = UCase(objItem.DnsHostName) objExcel.Cells(intRow, 2).Value = strIPAddress objExcel.Cells(intRow, 3).Value = strIPSubnet objExcel.Cells(intRow, 4).Value = strDefaultGateway objExcel.Cells(intRow, 5).Value = objItem.MacAddress intRow = intRow + 1 Next objExcel.Range("A1:E1").Select objExcel.Selection.Interior.ColorIndex = 19 objExcel.Selection.Font.ColorIndex = 11 objExcel.Selection.Font.Bold = True objExcel.Cells.EntireColumn.AutoFit loop Wscript.Echo "Done" |