Set WSHShell = WScript.CreateObject("WScript.Network") strComputer = WSHShell.ComputerName 'strComputer = InputBox ("Enter Machine Name") Dim objWMIService Set objExcel = CreateObject("Excel.Application") objExcel.Visible = True objExcel.Workbooks.Add objExcel.Cells(1, 1).Value = "Name" objExcel.Cells(2, 1).Value = "Caption" objExcel.Cells(3, 1).Value = "Version" objExcel.Cells(4, 1).Value = "Registered User" objExcel.Cells(5, 1).Value = "Serial Number" objExcel.Cells(6, 1).Value = "CSD Version" objExcel.Cells(7, 1).Value = "Description" objExcel.Cells(8, 1).Value = "Last Boot Up Time" objExcel.Cells(9, 1).Value = "Local Date Time" objExcel.Cells(10, 1).Value = "Organization" objExcel.Cells(11, 1).Value = "Domain" objExcel.Cells(12, 1).Value = "Manufacturer" objExcel.Cells(13, 1).Value = "Model" objExcel.Cells(14, 1).Value = "Number Of Processors" objExcel.Cells(15, 1).Value = "Primary Owner Name" objExcel.Cells(16, 1).Value = "System Type" objExcel.Cells(17, 1).Value = "Total Physical Memory" objExcel.Cells(18, 1).Value = "User Name" objExcel.Cells(19, 1).Value = "Caption" objExcel.Cells(20, 1).Value = "Manufacturer" objExcel.Cells(21, 1).Value = "Name" objExcel.Cells(22, 1).Value = "Release Date" objExcel.Cells(23, 1).Value = "Serial Number" objExcel.Cells(24, 1).Value = "SMBIOS BIOS Version" objExcel.Cells(25, 1).Value = "Version" Set objWMIService = GetObject("winmgmts:\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem") For Each objItem in colItems objExcel.Cells(1, 2).Value = objItem.CSName objExcel.Cells(2, 2).Value = objItem.Caption objExcel.Cells(3, 2).Value = objItem.Version objExcel.Cells(4, 2).Value = objItem.RegisteredUser objExcel.Cells(5, 2).Value = objItem.SerialNumber objExcel.Cells(6, 2).Value = objItem.CSDVersion objExcel.Cells(7, 2).Value = objItem.Description objExcel.Cells(8, 2).Value = objItem.LastBootUpTime objExcel.Cells(9, 2).Value = objItem.LocalDateTime objExcel.Cells(10, 2).Value = objItem.Organization Next Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem") For Each objItem in colItems objExcel.Cells(11, 2).Value = objItem.Domain objExcel.Cells(12, 2).Value = objItem.Manufacturer objExcel.Cells(13, 2).Value = objItem.Model objExcel.Cells(14, 2).Value = objItem.NumberOfProcessors objExcel.Cells(15, 2).Value = objItem.PrimaryOwnerName objExcel.Cells(16, 2).Value = objItem.SystemType objExcel.Cells(17, 2).Value = (objItem.TotalPhysicalMemory /1024) & "MB" objExcel.Cells(18, 2).Value = objItem.UserName Next Set objWMIService = GetObject("winmgmts:\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_BIOS") For Each objItem in colItems objExcel.Cells(19, 2).Value = objItem.Caption objExcel.Cells(20, 2).Value = objItem.Manufacturer objExcel.Cells(21, 2).Value = objItem.Name objExcel.Cells(22, 2).Value = objItem.ReleaseDate objExcel.Cells(23, 2).Value = objItem.SerialNumber objExcel.Cells(24, 2).Value = objItem.SMBIOSBIOSVersion objExcel.Cells(25, 2).Value = objItem.Version Next objExcel.Range("A1:A25").Select objExcel.Selection.Font.ColorIndex = 11 objExcel.Selection.Font.Bold = True objExcel.Cells.EntireColumn.AutoFit MsgBox "Terminé"
strComputer = "." Set objWMIService = GetObject("winmgmts:" & "!\" & strComputer & "\root\cimv2" ) Set colAdapters objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled True" ) For Each objAdapter in colAdapters IPdebut = LBound(objAdapter.IPAddress) IPfin = UBound(objAdapter.IPAddress) If (objAdapter.IPAddress(IPdebut) <> "" ) then For i = IPdebut To IPfin msg = msg & "utilise l'adresse IP " & objAdapter.IPAddress(i) & vbCrLf Next End If Next Wscript.Echo msg
http://yfrog.com/mvsanstitrewdp</code>
Je te remercie encore pour ton aide.
Cdt,
--
Rhunter,
L'urgent est fait, l'impossible est en cours,
Pour les miracles, prévoir un délai...
strComputer = "." Set objWMIService = GetObject("winmgmts:\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem") For Each objItem in colItems msg = msg & "Nom de l'ordinateur: " & vbCrLf & objItem.CSName & vbCrLf & vbCrLf msg = msg & "Numéro de série: " & vbCrLf & objItem.SerialNumber & vbCrLf & vbCrLf Next Set objWMIService = GetObject("winmgmts:" & "!\" & strComputer & "\root\cimv2" ) Set colAdapters objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled True" ) For Each objAdapter in colAdapters IPdebut = LBound(objAdapter.IPAddress) IPfin = UBound(objAdapter.IPAddress) If (objAdapter.IPAddress(IPdebut) <> "" ) then For i = IPdebut To IPfin msg = msg & "utilise l'adresse IP " & vbCrLf & objAdapter.IPAddress(i) & vbCrLf & vbCrLf Next End If Next Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem") For Each objItem in colItems msg = msg & "Modèle de l'ordinateur: " & vbCrLf & objItem.Model & vbCrLf & vbCrLf msg = msg & "Nom de l'utilisateur: " & vbCrLf & objItem.UserName & vbCrLf & vbCrLf Next Wscript.Echo msg
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question