1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| 'Initialisation des variables
Const ForReading = 1
Const ForWriting = 2
Dim oFso, f, w
Dim chaine
Set Fsw = CreateObject("Scripting.FileSystemObject")
Set oFso = CreateObject("Scripting.FileSystemObject")
Set f = oFso.OpenTextFile("C:\Documents and Settings\Michael BRUNIAS\Bureau\Liste.txt", ForReading)
While Not f.AtEndOfStream
ligne = f.readLine
chaine = split(ligne," ")
strComputer = chaine(0)
strUser = chaine(1)
strPassWord = chaine(2)
os = ""
'On récupére les données désirées
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objSWbemLocator.ConnectServer(strComputer,_
"root\CIMV2",_
strUser,_
strPassword,_
"MS_409",_
"ntlmdomain:" + strDomain)
'On récupere l'OS du PC
Set colItems = objWMIService.ExecQuery(_
"Select * FROM Win32_OperatingSystem",,48)
For Each objItem in colItems
os = objItem.Name
Next
'On récupere le constructeur du PC
Set colItems = objWMIService.ExecQuery(_
"SELECT * FROM Win32_BIOS",,48)
For Each objItems in colItems
manufac = objItems.Manufacturer
Next
'on créer un fichier avec les informations souhaités
information = manufac & ":" & os
if (Fsw.FileExists("C:\info.txt")) Then
w = Fsw.OpenTextFile("C:\info.txt",ForWriting,true)
w.write(information)
w.close()
Else
Set w = Fsw.createtextFile("C:\info.txt")
w.write(information)
w.close()
End if
Wend
f.close() |