le code vbs
on error resume Next
Set oShell = CreateObject("wscript.Shell")
Set env = oShell.environment("Process")
strComputer = env.Item("Computername")
Const HKEY_LOCAL_MACHINE = &H80000002
Const UnInstPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
".\root\default:StdRegProv")
report = report & "******************************************" & vbCrLf
report = report & " - Inventaire de l'ordinateur " & strComputer & " - " & vbCrLf
report = report & "******************************************" & vbCrLf & vbCrLf
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
report = report & vbCrLf & "******************************************" & vbCrLf
report = report & "Informations sur Windows" & vbCrLf & "******************************************" & vbCrLf
For Each objItem in colItems
report = report & "- Nom du poste: " & strComputer & vbCrLf
report = report & "- Description de l'ordinateur: " & objItem.Description & vbCrLf
report = report & "- Utilisateur possédant la licence Windows: " & objItem.RegisteredUser & vbCrLf
report = report & "- Organisation possédant la licence Windows: " & objItem.Organization & vbCrLf
report = report & "******************************************" & vbCrLf
report = report & "- Nom du système d'exploitation: " & objItem.Caption & vbCrLf
If (objItem.OSProductSuite <> "")Then
report = report & "- Système d'exploitation de la suite " & objItem.OSProductSuite & vbCrLf
End If
report = report & "- Version: " & objItem.Version & vbCrLf
report = report & "- Date de son installation: " & objItem.InstallDate & vbCrLf
report = report & "- Numéro de série de " & objItem.Caption & ": " & objItem.SerialNumber & vbCrLf
report = report & vbCrLf
report = report & "******************************************" & vbCrLf
report = report & "Détails techniques sur Windows"& vbCrlf
report = report & "******************************************" & vbCrLf
report = report & "- Numéro du dernier Service Pack majeur installé: "
report = report & objItem.ServicePackMajorVersion & vbCrLf
If (objItem.ServicePackMinorVersion<>0) AND (objItem.ServicePackMinorVersion<>"") Then
report = report & "- Numéro du dernier Service Pack mineur installé: " & objItem.ServicePackMinorVersion & vbCrLf
End If
report = report & "- - - - - -" & vbCrLf
report = report & "Les Service Pack et les mises-à-jour de sécurité de Windows sont disponibles sur:" & vbCrLf
report = report & "===>
http://windowsupdate.microsoft.com <===" & vbCrLf
report = report & "- - - - - -" & vbCrLf & vbCrLf
'report = report & "- Emplacements du système d'exploitation sur l'ordinateur: " & vbCrLf & objItem.Name & vbCrLf
report = report & "- Répertoire où Windows est installé: " & objItem.WindowsDirectory & vbCrLf
report = report & "- Niveau d'encryption des données: " & objItem.EncryptionLevel & " bits" & vbCrLf
If (objItem.MaxNumberOfProcesses="-1") Then
report = report & "- Maximum de processus pouvant être ouvert: Aucune limite fixée" & vbCrLf
Else
report = report & "- Maximum de processus pouvant être ouvert: " & objItem.MaxNumberOfProcesses & vbCrLf
End If
Next
Set colBaseBoards = objWMIService.ExecQuery _
("Select * from Win32_BaseBoard")
report = report & vbCrLf & "******************************************" & vbCrLf
report = report & "Carte-mère" & vbCrLf & "******************************************" & vbCrLf
For Each objBaseBoard in colBaseBoards
report = report & "- Nom: " & objBaseBoard.Name & vbCrLf
report = report & "- Modèle: " & objBaseBoard.Model & vbCrLf
report = report & "- Manufacturier: " & objBaseBoard.Manufacturer & vbCrLf
report = report & "- Numéro de série: " & objBaseBoard.SerialNumber & vbCrLf
report = report & "- Numéro d'inventaire (SKU): " & objBaseBoard.SKU & vbCrLf
report = report & vbCrLf
Next
Set colOnBoardDevices = objWMIService.ExecQuery _
("Select * from Win32_OnBoardDevice")
report = report & "******************************************" & vbCrLf
report = report & "Périphériques inclus sur la carte-mère (OnBoard)" & vbCrLf & "******************************************" & vbCrLf
For Each objOnBoardDevice in colOnBoardDevices
report = report & "- Nom du périphérique: " & objOnBoardDevice.Name & vbCrLf
report = report & "- Nom secondaire du périphérique: " & objOnBoardDevice.Caption & vbCrLf
report = report & "- Type de périphérique: " & objOnBoardDevice.DeviceType & vbCrLf
report = report & "- Modèle: " & objOnBoardDevice.Model & vbCrLf
report = report & "- Manufacturier: " & objOnBoardDevice.Manufacturer & vbCrLf
report = report & "- Numéro de série: " & objOnBoardDevice.SerialNumber & vbCrLf
report = report & "- Numéro d'inventaire (SKU): " & objOnBoardDevice.SKU & vbCrLf
report = report & vbCrLf
Next
Set colBIOS = objWMIService.ExecQuery _
("Select * from Win32_BIOS")
report = report & "******************************************" & vbCrLf
report = report & "BIOS - Utilitaire de détection des disques et" & vbCrLf
report = report & " de gestion des composantes internes" & vbCrLf & "******************************************" & vbCrLf
For Each objBIOS in colBIOS
report = report & "- Nom: " & objBIOS.Name & vbCrLf
report = report & "- Code d'identification: " & objBIOS.IdentificationCode & vbCrLf
report = report & "- Manufacturier: " & objBIOS.Manufacturer & vbCrLf
report = report & "- BIOS primaire: " & objBIOS.PrimaryBIOS & vbCrLf
report = report & "- Date de création: " & objBIOS.ReleaseDate & vbCrLf
report = report & "- Numéro de série: " & objBIOS.SerialNumber & vbCrLf
report = report & "- Version: " & objBIOS.Version & vbCrLf
report = report & "- Version (SMBIOS): " & objBIOS.SMBIOSBIOSVersion & vbCrLf
report = report & vbCrLf
Next
Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
report = report & "******************************************" & vbCrLf
report = report & "Mémoire vive (RAM) et processeur" & vbCrLf & "******************************************" & vbCrLf
For Each objComputer in colSettings
'report = report & objComputer.Name & vbcrlf
report = report & "- Vous avez actuellement " & objComputer.TotalPhysicalMemory /1024\1024+1 & " Mo de mémoire vive(RAM) au total." & vbcrlf
Next
report = report & "- - - - - -" & vbcrlf
report = report & "À titre de comparaison :" & vbcrlf
report = report & "Si vous avez Windows NT, 95 ou 98 vous devriez avoir au moins 64 Mo" & vbcrlf
report = report & " de mémoire vive pour une utilisation confortable" & vbcrlf
report = report & "Si vous avez Windows 2000, vous devriez avoir au moins 128 Mo de" & vbcrlf
report = report & " mémoire vive pour une utilisation confortable" & vbcrlf
report = report & "Si vous avez Windows XP ou 2003, vous devriez avoir au moins 256 Mo" & vbcrlf
report = report & " de mémoire vive pour une utilisation confortable" & vbcrlf
report = report & "- - - - - -" & vbcrlf & vbCrLf
Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_Processor")
For Each objProcessor in colSettings
report = report & "- Type de processeur: "
If objProcessor.Architecture = 0 Then
report = report & "x86" & vbCrLf
ElseIf objProcessor.Architecture = 1 Then
report = report & "MIPS" & vbCrLf
ElseIf objProcessor.Architecture = 2 Then
report = report & "Alpha" & vbCrLf
ElseIf objProcessor.Architecture = 3 Then
report = report & "PowerPC" & vbCrLf
ElseIf objProcessor.Architecture = 6 Then
report = report & "ia64" & vbCrLf
Else
report = report & "inconnu" & vbCrLf
End If
report = report & "- Nom du processeur: " & objProcessor.Name & vbCrLf
report = report & "- Description du processeur: " & objProcessor.Description & vbCrLf
report = report & "- Vitesse actuelle du processeur: " & objProcessor.CurrentClockSpeed & " Mhz" & vbCrLf
report = report & "- Vitesse maximale du processeur: " & objProcessor.MaxClockSpeed & " Mhz" & vbCrLf
report = report & vbCrLf
Next
report = report & "******************************************" & vbCrLf
report = report & "Disque(s) dur(s) et autres lecteurs actuellement " & vbCrLf
report = report & "en usage" & vbCrLf & "******************************************" & vbCrLf
Dim oFSO
Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")
Dim oDesLecteurs
Set oDesLecteurs = oFSO.Drives
Dim oUnLecteur
Dim strLectType
For Each oUnLecteur in oDesLecteurs
If oUnLecteur.IsReady Then
Select Case oUnLecteur.DriveType
Case 0: strLectType = "Inconnu"
Case 1: strLectType = "Amovible (Disquette, clé USB, etc.)"
Case 2: strLectType = "Fixe (Disque dur, etc.)"
Case 3: strLectType = "Réseau"
Case 4: strLectType = "CD-Rom"
Case 5: strLectType = "Virtuel"
End Select
report = report & "- Lettre du lecteur: " & oUnLecteur.DriveLetter & vbCrLf
report = report & "- Numéro de série: " & oUnLecteur.SerialNumber & vbCrLf
report = report & "- Type de lecteur: " & oUnLecteur.strLectType & vbCrLf
If (oUnLecteur.FileSystem <> "") Then
report = report & "- Système de fichier utilisé: " & oUnLecteur.FileSystem & vbCrLf
End If
Set objWMIService = GetObject("winmgmts:")
Set objLogicalDisk = objWMIService.Get("Win32_LogicalDisk.DeviceID='" & oUnLecteur.DriveLetter & ":'")
report = report & "- Il y a " & objLogicalDisk.FreeSpace /1024\1024+1 & " Mo d'espace restant sur ce lecteur/disque" & vbCrLf
report = report & "- Il y a " & objLogicalDisk.Size /1024\1024+1 & " Mo d'espace au total sur ce lecteur/disque" & vbCrLf
End If
report = report & vbCrLf
Next
Set colCartesVideo = objWMIService.ExecQuery _
("Select Description From Win32_VideoController")
report = report & "******************************************" & vbCrLf
report = report & "Carte(s) vidéo" & vbCrLf & "******************************************" & vbCrLf
For Each objCarteVideo in colCartesVideo
report = report & "- Nom de la carte: " & objCarteVideo.Description & vbcrlf
report = report & vbCrLf
Next
Set colSoundDevices = objWMIService.ExecQuery _
("Select * from Win32_SoundDevice")
report = report & "******************************************" & vbCrLf
report = report & "Carte(s) de son" & vbCrLf & "******************************************" & vbCrLf
For Each objSoundDevice in colSoundDevices
report = report & "- Nom de la carte: " & objSoundDevice.Description & vbCrLf
report = report & vbCrLf
Next
Set colInstalledPrinters = objWMIService.ExecQuery _
("Select * from Win32_Printer")
report = report & "******************************************" & vbCrLf
report = report & "Imprimante(s) installée(s)" & vbCrLf & "******************************************" & vbCrLf
For Each objPrinter in colInstalledPrinters
If objPrinter.Default = "True" Then
report = report & "- Nom de l'imprimante (par défaut): " & objPrinter.Name & vbCrLf
Else
report = report & "- Nom de l'imprimante: " & objPrinter.Name & vbCrLf
End If
report = report & vbCrLf
Next
Set colAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapter")
report = report & "******************************************" & vbCrLf
report = report & "Carte(s) réseau(x)" & vbCrLf & "******************************************" & vbCrLf
For Each objAdapter in colAdapters
If (objAdapter.Manufacturer<>"Microsoft") Then
'report = report & "- Nom de la carte/adapteur (Caption): " & objAdapter.Caption & vbcrlf
report = report & "- Nom de la carte/adapteur: " & objAdapter.Name & vbcrlf
report = report & "- Type de la carte/adapteur: " & objAdapter.AdapterType & vbcrlf
'report = report & "- État actuel: " & objAdapter.Availability & vbcrlf
report = report & "- Description: " & objAdapter.Description & vbcrlf
report = report & "- Adresse MAC: " & objAdapter.MACAddress & vbcrlf
'report = report & "- Adresse réseau de la carte: " & objAdapter.NetworkAddresses & vbcrlf
'report = report & "- Adresse préprogrammée: " & objAdapter.PermanentAddress & vbcrlf
report = report & "- Nom du fabricant: " & objAdapter.Manufacturer & vbcrlf
report = report & "- Nom du produit: " & objAdapter.ProductName & vbcrlf
report = report & "- Nom de service: " & objAdapter.ServiceName & vbcrlf
report = report & "- Vitesse maximale: " & objAdapter.MaxSpeed & vbcrlf
'If (objAdapter.Speed = 0) Or (objAdapter.Speed = "") Then
' report = report & "- Bande passante actuelle: Non-disponible ou si faible qu'elle indique 0" & vbcrlf
'Else
' report = report & "- Bande passante actuelle: " & objAdapter.Speed & vbcrlf
'End If
'report = report & "- Date de la dernière réinitialisation: " & objAdapter.TimeOfLastReset & vbcrlf
Set colAdaptersConf = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration")
For Each objAdapterConf in colAdaptersConf
If (objAdapter.Manufacturer<>"Microsoft") AND (objAdapter.Caption = objAdapterConf.Caption) Then
report = report & "==> Configurations de la carte réseau <==" & vbcrlf
report = report & "- Adresse IP: " & objAdapterConf.IPAddress & vbcrlf
report = report & "- Masque de sous-réseau: " & objAdapterConf.IPSubnet & vbcrlf
report = report & "- Le DHCP (Attribution automatique d'une adresse IP par un serveur DHCP) est-il activé:" & vbCrLf
report = report & objAdapterConf.DHCPEnabled & vbcrlf
report = report & "- Serveur DHCP: " & objAdapterConf.DHCPServer & vbcrlf
report = report & "- Serveur(s) DNS: " & objAdapterConf.DNSServerSearchOrder & vbcrlf
End If
Next
End If
Next
report = report & "- - - - - -" & vbcrlf
report = report & "Si vous ne pouvez naviguer et que les configurations IP semblent correctes," & vbcrlf
report = report & "vous pouvez essayer l'utilitaire WinsockFix.exe =>" & vbcrlf
report = report & "
http://www.google.ca/search?hl=fr&rls=G ... cher&meta=" & vbcrlf
report = report & "- - - - - -" & vbcrlf
report = report & vbcrlf
Set colPOTSModems = objWMIService.ExecQuery _
("Select * from Win32_POTSModem")
report = report & "******************************************" & vbCrLf
report = report & "Modem(s)" & vbCrLf & "******************************************" & vbCrLf
For Each objPOTSModem in colPOTSModems
report = report & "- Nom du modem: " & objPOTSModem.Description & vbCrLf
report = report & vbCrLf
Next
Set colEcrans = objWMIService.ExecQuery _
("Select * from Win32_Win32_DesktopMonitor")
report = report & "******************************************" & vbCrLf
report = report & "Écran(s)" & vbCrLf & "******************************************" & vbCrLf
For Each objEcran in colEcrans
report = report & "- Nom de l'écran: " & objEcran.Name & vbCrLf
report = report & "- Type d'écran: " & objEcran.MonitorType & vbCrLf
report = report & "- Nom du fabricant: " & objEcran.MonitorManufacturer & vbCrLf
report = report & "- Hauteur: " & objEcran.ScreenHeight & vbCrLf
report = report & "- Largeur: " & objEcran.ScreenWeight & vbCrLf
report = report & vbCrLf
Next
' report = report & "******************************************" & vbCrLf
' report = report & "Listes des connexions réseaux"& vbCrlf
' report = report & "=> Cette section peut parfois être vide même s'il" & vbCrLf
' report = report & " existe des connexions réseaux <=" & vbCrLf
' report = report & "******************************************" & vbCrLf
'Set colConnReseaux = objWMIService.ExecQuery _
' ("Select * from Win32_NetworkConnection")
'For Each objConnReseau in colConnReseaux
' report = report & "- Nom de la carte/adapteur: " & objConnReseau.Name & vbcrlf
' report = report & "- Nom local: " & objConnReseau.LocalName & vbcrlf
' report = report & "- Nom d'utilisateur: " & objConnReseau.UserName & vbcrlf
' report = report & "- Type: " & objConnReseau.DisplayType & vbcrlf
' report = report & "- Description: " & objConnReseau.Description & vbcrlf
' report = report & "- État actuel de la connexion: " & objConnReseau.ConnectionState & vbcrlf
' report = report & "- Nom du fournisseur: " & objConnReseau.ProviderName & vbcrlf
' report = report & "- Nom de la ressource distante: " & objConnReseau.RemoteName & vbcrlf
' report = report & "- Type de ressource: " & objConnReseau.ResourceType & vbcrlf
' report = report & "- Commentaire du fournisseur: " & objConnReseau.Comment & vbcrlf
' report = report & vbcrlf
'Next
Set colUsagers = objWMIService.ExecQuery _
("Select * from Win32_Account")
report = report & "******************************************" & vbCrLf
report = report & "Utilisateurs et groupes d'utilisateurs de cet ordinateur" & vbCrLf & "******************************************" & vbCrLf
For Each objUsager in colUsagers
report = report & "- Nom de l'usager ou du groupe: " & objUsager.Name & vbcrlf
report = report & "- Description: " & objUsager.Description & vbcrlf
report = report & "- Domaine ou ordinateur auquel il appartient: " & objUsager.Domain & vbcrlf
'report = report & "- Numéro d'identification (SID): " & objUsager.SID & vbcrlf
report = report & vbcrlf
Next
oReg.EnumKey HKEY_LOCAL_MACHINE, UnInstPath, arrSubKeys
software = "******************************************" & vbCrLf
software = software & "Logiciels installés" & vbCrLf & "******************************************" & vbCrLf
For Each subkey In arrSubKeys
'MsgBox subkey
If Left (subkey, 1) <> "{" Then
software = software & subkey & vbCrLf
End If
Next
software = software & "- - - - - -" & vbCrLf
software = software & "Assurez-vous d'avoir dans la liste ci-dessus:" & vbCrLf
software = software & "- Un anti-virus => Si non, voir
http://www.sogetel.net/virus/" & vbCrLf
software = software & "- Un logiciel anti-espiogiciel => Si non, voir
http://www.sogetel.net/espions/" & vbCrLf
software = software & "- Certaines mises-à-jour de Windows (Elle commence fréquemment par KB#### ou bien par Q###)" & vbCrLf
software = software & "- - - - - -" & vbCrLf
software = software & vbCrLf
Set fso = CreateObject("Scripting.FileSystemObject")
'Détermine si le fichier texte existe déjà ou s'il doit le créer
If Not fso.FileExists("inventaire" & strComputer & ".txt") Then
set ts = fso.CreateTextFile("inventaire" & strComputer & ".txt", True)
Else
set ts = fso.OpenTextFile("inventaire" & strComputer & ".txt", 2, True)
End If
ts.write report
ts.write software
'MsgBox Report
WScript.Exit
Le code bat
start c:\rep\fichier.vbs
Merci