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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
| 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")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
Set dtmConvertedDate = CreateObject("WbemScripting.SWbemDateTime")
report = report & "******************************************" & vbCrLf
report = report & " - Information de l'ordinateur " & strComputer & " - " & vbCrLf
report = report & "******************************************" & vbCrLf & vbCrLf
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
dtmConvertedDate.Value = objItem.InstallDate
dtmInstallDate = dtmConvertedDate.GetVarDate
report = report & "- Date de son installation: " & dtmInstallDate & 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.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
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"
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
'srComputer = "."
'Set objWMIService = GetObject("winmgmts:" & "!\\" & srComputer & "\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
ComputerName="."
On error resume next
set IPConfigSet = GetObject("winmgmts:{impersonationLevel=impersonate}!//" & ComputerName).ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=TRUE")
If Err.Number<>0 Then
wscript.echo " - non accessible -"
Else
for each IPConfig in IPConfigSet
BailObtenu = IPConfig.DHCPLeaseObtained
BailExpirant = IPConfig.DHCPLeaseExpires
'---- Convertion des date et heure d'obtention et d'expiration des baux DHCP en un format lisible par l'utilisateur. ----
BailObtenu = mid(BailObtenu, 7, 2) & "/" & mid(BailObtenu, 5, 2) & "/" & mid(BailObtenu, 1, 4) & " - " & mid(BailObtenu, 9, 2)& ":" & mid(BailObtenu, 11, 2)& ":" & mid(BailObtenu, 13, 2)
BailExpirant = mid(BailExpirant, 7, 2) & "/" & mid(BailExpirant, 5, 2) & "/" & mid(BailExpirant, 1, 4) & " - " & mid(BailExpirant, 9, 2)& ":" & mid(BailExpirant, 11, 2)& ":" & mid(BailExpirant, 13, 2)
msg = " Configuration réseau de l'ordinateur " & ComputerName & vbcrlf & vbcrlf & _
"Nom Machine " & vbtab & " : " & IPConfig.DNSHostName & vbcrlf & _
"Carte active" & vbtab & " : " & IPConfig.Description & vbcrlf & _
"Adresse MAC " & vbtab & " : " & IPConfig.MACAddress & vbcrlf & _
"DHCP Activé" & vbtab & " : " & IPConfig.DHCPEnabled & vbcrlf & _
"Adresse IP " & vbtab & " : " & IPConfig.IPAddress(0) & vbcrlf & _
"Masque " & vbtab & vbtab & " : " & IPConfig.IPSubnet(0) & vbcrlf & _
"Passerelle " & vbtab & " : " & IPConfig.DefaultIPGateway(0) & vbcrlf & _
"Serveur DHCP " & vbtab & " : " & IPConfig.DHCPServer & vbcrlf & vbcrlf & _
"Serveur DNS " & vbtab & " : " & IPConfig.DNSServerSearchOrder(0) & vbcrlf & _
""& vbtab & vbtab & " : " & IPConfig.DNSServerSearchOrder(1) & vbcrlf & _
"Serveur WINS " & vbtab & " : " & IPConfig.WINSPrimaryServer(0) & vbcrlf & _
" " & vbtab & vbtab & " : " & IPConfig.WINSSecondaryServer(0) & vbcrlf & vbcrlf & _
" Bail obtenu " & vbtab & " : " & BailObtenu & vbcrlf & _
" Bail expirant " & vbtab & " : " & BailExpirant
',VbInformation,"Configuration réseau de l'ordinateur "
Next
End If
'strComputer = "."
strMessage=""
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSettings = objWMIService.ExecQuery ("Select * from Win32_ComputerSystem")
Set colSettings2 = objWMIService.ExecQuery ("Select * from Win32_BIOS")
Set colSettings3 = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
For Each objBIOS in colSettings2
strMessage=strMessage & "BIOS " & objBIOS.Version & vbNewline & vbNewline
Next
For Each objComputer in colSettings
strMessage=strMessage & "Nom de l'ordinateur : " & objComputer.Name & vbNewline & "Fabriquant: " & objComputer.Manufacturer & vbNewline & "Modèle : " & objComputer.Model & vbNewline & vbNewline
Next
For Each objOperatingSystem in colSettings3
strMessage=strMessage & objOperatingSystem.Name & vbNewline
strMessage=strMessage & "Version " & objOperatingSystem.Version & vbNewline
strMessage=strMessage & "Service Pack " & objOperatingSystem.ServicePackMajorVersion & "." & objOperatingSystem.ServicePackMinorVersion &vbNewline
strMessage=strMessage & "Dossier de Windows: " & objOperatingSystem.WindowsDirectory &vbNewline
Next
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.WriteLine strMessage
ts.write report & "******************************************" & vbCrLf
'ts.write software
ts.write msg
MsgBox msg,VbInformation,"Configuration réseau de l'ordinateur "
Set ws = CreateObject("wscript.shell")
ws.run "notepad inventaire_" & strComputer & ".txt" |
Partager