Ip et domaine

Leo_Robotic_Passion Messages postés 135 Date d'inscription dimanche 19 novembre 2000 Statut Membre Dernière intervention 2 décembre 2011 - 26 août 2008 à 11:22
Leo_Robotic_Passion Messages postés 135 Date d'inscription dimanche 19 novembre 2000 Statut Membre Dernière intervention 2 décembre 2011 - 26 août 2008 à 14:12
Bonjour,
Pourriez-vous m'aider svp à modifier ce script pour obtenir aussi l'IP des machines svp ?

Option Explicit


Dim objExcel, intRow, strDomain, DomObj, objItem

Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
intRow = 2
objExcel.Cells(1, 1).Value = "Machine Name"
strDomain = InputBox ("Enter Domain Name")
Set DomObj = GetObject("WinNT://" & strDomain )
DomObj.Filter = Array("computer")
For Each objItem In DomObj
objExcel.Cells(intRow, 1).Value = objItem.Name
intRow = intRow + 1
Next
objExcel.Range("A1:A1").Select
objExcel.Selection.Interior.ColorIndex = 19
objExcel.Selection.Font.ColorIndex = 11
objExcel.Selection.Font.Bold = True
objExcel.Cells.EntireColumn.AutoFit
MsgBox "ok"

1 réponse

Leo_Robotic_Passion Messages postés 135 Date d'inscription dimanche 19 novembre 2000 Statut Membre Dernière intervention 2 décembre 2011
26 août 2008 à 14:12
J'ai tenté cette modif, mais je ne m'en sort pas!
Quelqu'un peut m'aider svp?

Option Explicit
Dim objExcel, intRow, strDomain, DomObj, objItem
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
intRow = 2
objExcel.Cells(1, 1).Value = "Machine Name"
strDomain = InputBox ("Enter Domain Name","","chlons.fr")
Set DomObj = GetObject("WinNT://" & strDomain )
DomObj.Filter = Array("computer") 
For Each objItem In DomObj 
objExcel.Cells(intRow, 1).Value = objItem.Name
Dim strComputer
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\" _
& strComputer & "\root\cimv2")
For Each cartereseau in objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
For Each adresseIP in cartereseau.IPAddress
objExcel.Cells(intRow, 2).Value = adresseIP
Next
Next
intRow = intRow + 1
Next
objExcel.Range("A1:b1").Select
objExcel.Selection.Interior.ColorIndex = 19
objExcel.Selection.Font.ColorIndex = 11
objExcel.Selection.Font.Bold = True
objExcel.Cells.EntireColumn.AutoFit
MsgBox "ok"
0
Rejoignez-nous