Numero de série Ecran

cs_raphu Messages postés 1 Date d'inscription samedi 8 octobre 2005 Statut Membre Dernière intervention 20 octobre 2005 - 20 oct. 2005 à 12:55
crenaud76 Messages postés 4172 Date d'inscription mercredi 30 juillet 2003 Statut Membre Dernière intervention 9 juin 2006 - 20 oct. 2005 à 15:18
Bonjour,

Je cherche le moyen en VBscript de récuperer le numero de série de l'écran connecter à un ordinateur. Cela me permettrai de terminer mon programme d'inventaire.

Dim Reponse
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
On error resume next
Rem --Définit l'ordinateur local comme étant le système traité par le script.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\" & strComputer & "\root\cimv2")


Reponse= "Date ; " & Now & " ; "
'**************************************************
Rem --On initialise colSettings par l'objet Automation WMIService.ExecQuery porté sur Win32_CS.
Set colSettings = objWMIService.ExecQuery ("Select * from Win32_ComputerSystem")
Rem --Pour toutes les informations Win32_ComputerSystem...
For Each objComputer in colSettings
Reponse=Reponse & "Login ; " & objComputer.UserName & " ; "
Reponse=Reponse & "Hostname ; " & objComputer.Name & " ; "
Reponse=Reponse & "Manufacturer ; " & objComputer.Manufacturer & " ; "
Reponse=Reponse & "Model ; " & objComputer.Model & " ; "
next


'**************************************************
Set colSettings = objWMIService.ExecQuery ("Select * from Win32_BIOS")
Rem --Pour l'information Win32_BIOS...
For Each objBIOS in colSettings
Reponse= reponse & "S/N ; " & objBIOS.SerialNumber & " ; "
next


' Chassis
'**************************************************
Set colChassis = objWMIService.ExecQuery ("Select * from Win32_SystemEnclosure")
For Each objChassis in colChassis
For i = Lbound(objChassis.ChassisTypes) to Ubound(objChassis.ChassisTypes)
Rem --Définition de la variable (i) pour informations correspondantes au format textuel.
Select Case objChassis.ChassisTypes(i)
Case 3
strComputerChassis = "Desktop"
Case 6
strComputerChassis = "Mini Tower"
Case 8
strComputerChassis = "Portable"
Case 9
strComputerChassis = "LapTop"
Case 10
strComputerChassis = "NoteBook"
Case 11
strComputerChassis = "Hand Held"
Case 12
strComputerChassis = "Docking Station"
Case 23
strComputerChassis = "Rack Mount Chassis"
End Select

Rem --On note le résultat de la propriété (i) et subtitution textuel.
Reponse=Reponse & objChassis.ChassisTypes(i) & " - " & strComputerChassis & " ; "
Next
Next
set fso = CreateObject("Scripting.FileSystemObject")


' Adresse IP
'***************************************
Dim WshShell,Command,File,Lecture
Set WshShell=WScript.CreateObject("WScript.Shell")
Command = "%COMSPEC% /C ipconfig.exe > c:\command.txt"
Result = WshShell.Run(Command,0,True)
Set File = fso.OpenTextFile("c:\command.txt",1,true)
do until file.atendofstream
Lecture= file.Readline()
if mid(Lecture,9,10)= "Adresse IP" then ping=ping & lecture & " ; "
loop
file.Close
fso.DeleteFile ("c:\command.txt"),True
Reponse=Reponse & ping


'***************************************
set fso = CreateObject("Scripting.FileSystemObject")
Set Logx = fso.OpenTextFile("[file://141.86.43.60/FRANCE$/CSE2_FRANCE.txt%22,8,True c:\info.txt",8,True])
logx.writeline Reponse


logx.close

1 réponse

crenaud76 Messages postés 4172 Date d'inscription mercredi 30 juillet 2003 Statut Membre Dernière intervention 9 juin 2006 28
20 oct. 2005 à 15:18
Jamais réussi à trouvé le S/N de l'écran dans les classes WMI ... mais si tu le trouve, cela m'intéresse aussi
0
Rejoignez-nous