Bonjour,

Je cherche a mettre en place un systeme de barre d'avancement dans un de mes scripts pour cela je me suis appuyer sur se post: http://www.developpez.net/forums/d73...ement-fenetre/

ou j'ai choisi la methode
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
'__________________________________________
'parametrage de la barre IE
'__________________________________________
Dim gdocProgressBar 'requis pour objet internet explorer
Dim goieProgressBar	'requis pour objet internet explorer
Set gdocProgressBar = Nothing
Set goieProgressBar = Nothing
 
'__________________________________________
'Code
'__________________________________________
ProgressBar 0
wscript.sleep 1000
ProgressBar 20
wscript.sleep 1000
ProgressBar 40
wscript.sleep 1000
ProgressBar 60
wscript.sleep 1000
ProgressBar 80
wscript.sleep 1000
ProgressBar 100
wscript.sleep 2000
ProgressBar -1
 
 
'__________________________________________
'fonction de la progress bar
'__________________________________________
Sub ProgressBar(intPercent)
	'intPercent doit rester entre 0 et 100 
	If gdocProgressBar Is Nothing Then
		If ((Cint(intPercent) >= 0) And (Cint(intPercent) <= 100)) Then
			Set goieProgressBar = CreateObject("InternetExplorer.Application")
			goieProgressBar.Offline = True
			goieProgressBar.AddressBar = False
			goieProgressBar.Height = 100
			goieProgressBar.Width = 250
			goieProgressBar.MenuBar = False
			goieProgressBar.StatusBar = False
			goieProgressBar.Silent = True
			goieProgressBar.ToolBar = False
			goieProgressBar.Navigate "about:blank"
			Do While goieProgressBar.Busy
				WScript.Sleep 100
			Loop
			'On Error Resume Next
			Set gdocProgressBar = Nothing
			Do Until Not gdocProgressBar Is Nothing
				WScript.Sleep 100
				Set gdocProgressBar = goieProgressBar.Document
			Loop
			gdocProgressBar.Open
			gdocProgressBar.Write "<html><head><title>"
			gdocProgressBar.Write "Status"
			gdocProgressBar.Write "</title></head><body><center>"
			gdocProgressBar.Write "<TABLE width=200 border=3 frame=box><tr><td>"
			gdocProgressBar.Write "<TABLE id=status width=0 border=0 cellpadding=0 cellspacing=0 bgcolor=#FFFFFF>"
			gdocProgressBar.Write "<tr><td>&nbsp</td></tr></table></td></tr></table></center></body></html>"
			gdocProgressBar.Close
			goieProgressBar.Visible = True			
		Else
			Exit Sub
		End If
	End If
	'Ferme la barre d'etat
	If Not gdocProgressBar Is Nothing Then
		If ((Cint(intPercent) < 0) Or (Cint(intPercent) > 100)) Then
			goieProgressBar.Visible = False
			Set gdocProgressBar = Nothing
			goieProgressBar.Quit
			Set goieProgressBar = Nothing
			Exit Sub
		End If
	End If
	'met a jour la barre d'etat
	If Cint(intPercent) = 0 Then
		gdocProgressBar.all.status.width = "1%"
		gdocProgressBar.all.status.bgcolor = "#FFFFFF"
	Else
		gdocProgressBar.all.status.width = Cstr(Cint(intPercent)) & "%"
		gdocProgressBar.all.status.bgcolor = "#0000FF"
	End If
End Sub
celle ci fonctionne parfaitement dans un vbs , mais lorsque je cherche a l'integrer a mon .hta la c'est la cata
J'ai resolu le probleme de wscript.sleep par une fonction sleep rajouter en fin de programme.
Mais par contre maintenant la barre d'avancement dans une une nouvelle page IE a chaque "mise a jour" et ne se ferme pas ... et la je ne vois vraiment pas pourquoi .... je vous joins mon script pour que vous puissiez faire un essai...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
 
<TITLE>Systeme de surveillance du materiel</TITLE>
 
<script language="vbs">
ResizeTo 350,200
MoveTo 250,200
</script>
 
<center>
 <fieldset>
 <BODY>
<BODY LINK=#F6E497> 
 Qu'elle opération voulez vous lancez ? : <BR><BR>
<INPUT TYPE="radio" NAME="resultatQ" VALUE="Creation du fichier source" CHECKED>Creation du fichier source<BR>
<INPUT TYPE="radio" NAME="resultatQ" VALUE="Test de la configuration materiel">Test de la configuration materiel<BR><BR>
 <input type="button" value="Lancement du script" onClick="btValider_onclick">
 </BODY>
 </fieldset>
 <HEAD>
 
<HTA:APPLICATION
      APPLICATION="htaBouton"
   > 
 </HEAD>
 <script language="VBScript">
 
Sub btValider_OnClick
	creation_source
	test_materiel
end sub
 
Sub creation_source
 
    if resultatQ(0).Checked  then
		'---------------------------------------------------------------------------------------------------------------------------------------------------
		'----------------------------------------------------Information sur l'ordinateur ------------------------------------------------------------------
		'---------------------------------------------------------------------------------------------------------------------------------------------------
		On Error Resume Next
 
		const forappending=8
		Dim objNetwork, objDrive, intDrive, intNetLetter 
		Dim FSO, ObjFile, WshNetwork, SrtNewText, strText
		Set objFSO = CreateObject("Scripting.FileSystemObject")
		Set WshNetwork = CreateObject("WScript.Network")
		Set objShell = CreateObject("WScript.Shell")
		hostname = WshNetwork.computername
		domainname = WshNetwork.UserDomain
		path = "C:\surveillance\" 																'adresse ou sera enregistrer le fichier texte
		fichiersortie=(path & hostname &".txt")
		Dim gdocProgressBar 'requis pour objet internet explorer
		Dim goieProgressBar	'requis pour objet internet explorer
		Set gdocProgressBar = Nothing
		Set goieProgressBar = Nothing
		objFSO.DeleteFile fichiersortie						 										'supression de l'ancien fichier
 
		ProgressBar 0
		Sleep 1000
 
		If  objFSO.FolderExists (""&path&"") Then
	  Else
		Set objFolder = objFSO.CreateFolder (""&path&"")
		End If
 
		Set objFSO = CreateObject("Scripting.FileSystemObject")
		Set objTextFile = objFSO.CreateTextFile(""&path&""&hostname &".txt", True) 'creation du fichier txt 
		'---------------------------------------------------------------------------------------------------------------------------------------------------
		'---------------------------------------INFOS GENERALES (Nom du poste, nom de l'utilisateur actuel) ------------------------------------------------
		'---------------------------------------------------------------------------------------------------------------------------------------------------
		objTextFile.WriteLine "== GENERAL =========================================================="&VbCrLf&""
		objTextFile.WriteLine "Nom du poste : "& hostname &""
		Set objWMISvc = GetObject( "winmgmts:\\.\root\cimv2" )
		Set colItems = objWMISvc.ExecQuery( "Select * from Win32_ComputerSystem", , 48 )
		For Each objItem in colItems
		strComputerDomain = objItem.Domain
		If objItem.PartOfDomain Then
		objTextFile.WriteLine "Domaine : " & strComputerDomain				'ecris le domaine dans lequel se trouve le pc
			Else
				objTextFile.WriteLine "Workgroup : " & strComputerDomain 			'ecris dans quel groupe est le pc si il est pas dans un domaine
			End If
		objTextFile.WriteLine "Marque : " & objItem.Manufacturer 					'ecris la marque de l'ordinateur
		objTextFile.WriteLine "Modele : " & objItem.Model 							'ecris le modele de l'ordinateur
		Next
		Set SNSet = GetObject("winmgmts:").InstancesOf ("Win32_BIOS")
		for each SN in SNSet
		objTextFile.WriteLine "Serial : " & SN.SerialNumber 						'ecris le serial du pc
		Next
		objTextFile.WriteLine
		ProgressBar 20
		Sleep 1000
		'---------------------------------------------------------------------------------------------------------------------------------------------------
		'-------------------------------------------------------INFOS SUR LE SYSTEME -----------------------------------------------------------------------
		'---------------------------------------------------------------------------------------------------------------------------------------------------
		objTextFile.WriteLine "== SYSTEME EXPLOITATION ============================================="&VbCrLf&""
		Set dtmConvertedDate = CreateObject("WbemScripting.SWbemDateTime")
		strComputer = "."
		Set objWMIService = GetObject("winmgmts:" _
		& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
		Set colOperatingSystems = objWMIService.ExecQuery _
		("Select * from Win32_OperatingSystem")
 
		For Each objOperatingSystem in colOperatingSystems
 
		objTextFile.WriteLine "OS : " & objOperatingSystem.Caption                        			'determine et ecris l'os du pc
		objTextFile.WriteLine "Version: " & objOperatingSystem.Version								'determine et ecris la version
		objTextFile.WriteLine "Service Pack : " & objOperatingSystem.ServicePackMajorVersion		'determine et ecris le service pack
		objTextFile.WriteLine "Numero Serie : " & objOperatingSystem.SerialNumber					'determine et ecris le numero de serie
		objTextFile.WriteLine "Type Version : " & objOperatingSystem.BuildType						'determine et ecris le type de version
		dtmConvertedDate.Value = objOperatingSystem.InstallDate
		dtmInstallDate = dtmConvertedDate.GetVarDate
		objTextFile.WriteLine "Date d'Installation : " & dtmInstallDate 							'determine et ecris la date d'installation
		objTextFile.WriteLine
		Next
		ProgressBar 40
		Sleep 1000
		'---------------------------------------------------------------------------------------------------------------------------------------------------
		'-------------------------------------------------------------INFORMATIONS MATERIEL ----------------------------------------------------------------
		'---------------------------------------------------------------------------------------------------------------------------------------------------
 
		objTextFile.WriteLine "== PROCESSEUR & RAM ================================================="&VbCrLf&""
 
		Set colComputer = objWMIService.ExecQuery("Select * from Win32_Processor")
		For Each objComputer In colComputer
		objTextFile.WriteLine "Processeur :"& vbTab &"" & objComputer.Name					'determine et ecris le nom du processeur
		Next
 
		Set colSettings = objWMIService.ExecQuery ("SELECT * FROM Win32_Processor")
		For Each objProcessor In colSettings
		objTextFile.WriteLine "Type Processeur : "& vbTab &"" & objProcessor.Description		'determine et ecris le type de processeur
		Next
		objTextFile.WriteLine
 
		Set colComputer = objWMIService.ExecQuery ("Select * from Win32_ComputerSystem")
		For Each objComputer In colComputer
		objTextFile.WriteLine "RAM Total : "&FormatNumber (objComputer.TotalPhysicalMemory /1048576+1, 0) & "Mo"	'determine et ecris la RAM
			objTextFile.WriteLine
		Next
 
		For Each objMem In GetObject("winmgmts:{impersonationLevel=impersonate}\\" & strComputer & "\root\cimv2").InstancesOf("Win32_PhysicalMemory")
			objTextFile.WriteLine ""& vbTab &"+"&  objMem.BankLabel &" : "& objMem.Capacity/1024/1024 & " Mo"			'determine et ecris la RAM par slot
		Next
 
		objTextFile.WriteLine ""&VbCrLf&"== DISQUE DUR & PARTITIONS =========================================="&VbCrLf&""
		objTextFile.WriteLine "Disques Physiques :"
		Set colItems = objWMIService.ExecQuery(_
		"Select * from Win32_DiskDrive")
					maxsize = 0
					drive = 0
					For Each objItem in colItems
		If objItem.Partitions > 0 and objItem.Name = "\\.\PHYSICALDRIVE0"  Then
		objTextFile.WriteLine ""&vbTab &"Nom : "& vbTab &"" & objItem.Name 										'determine et ecris le nom du/des DD
		objTextFile.WriteLine ""&vbTab &"Taille : " & Int(objItem.Size /(1073741824)) & " GB" 					'determine et ecris la taille du/des DD
		objTextFile.WriteLine ""&vbTab &"Modèle : " & objItem.Model 											'determine et ecris la marque du/des DD
		objTextFile.WriteLine ""&vbTab &"Nbr de partition(s) : "& vbTab &"" & objItem.Partitions &VbCrLf&"" 	'determine et ecris le nombre de partition
 
			maxsize = maxsize + Int(objItem.Size /(1073741824))
			drive = drive + 1
			Else
			End If
			Next
 
		objTextFile.WriteLine"Espace Total : "&maxsize&" Go dans "&drive&" disques durs"						'determine et ecris la somme des DD
 
		ProgressBar 60
		Sleep 1000
 
		'---------------------------------------------------------------------------------------------------------------------------------------------------
		'----------------------------------------------------------RESEAU ----------------------------------------------------------------------------------
		'---------------------------------------------------------------------------------------------------------------------------------------------------
		objTextFile.WriteLine ""&VbCrLf&"== RESEAU ==========================================================="&VbCrLf&""
		Set colNicConfigs = objWMIService.ExecQuery _
		("Select * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
 
		Set objWMIService = GetObject("winmgmts:" _
		& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
		Set colAdapters = objWMIService.ExecQuery _
		("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
 
			n = 1
			objTextFile.WriteLine
 
		For Each objAdapter in colAdapters
		objTextFile.WriteLine "Carte Réseau - " & objAdapter.Description									'determine et ecris le nom de la carte reseau
		objTextFile.WriteLine "  Adresse MAC : " & vbTab & objAdapter.MACAddress							'determine et ecris l'adresse mac de la carte
 
		If Not IsNull(objAdapter.IPAddress) Then
		For i = 0 To UBound(objAdapter.IPAddress)
		objTextFile.WriteLine "  Adresse IP : " &vbTab & vbTab & objAdapter.IPAddress(i)			'determine et ecris l'adresse ip
		 Next
		End If
		ProgressBar 80
		Sleep 1000			 
		   If Not IsNull(objAdapter.IPSubnet) Then
		  For i = 0 To UBound(objAdapter.IPSubnet)
		 objTextFile.WriteLine "  Sous Réseau: " &vbTab & vbTab & objAdapter.IPSubnet(i)			'determine et ecris le masque de sous reseau
			  Next
		   End If
 
		   If Not IsNull(objAdapter.DefaultIPGateway) Then
		  For i = 0 To UBound(objAdapter.DefaultIPGateway)
		 objTextFile.WriteLine "  Passerelle : " &vbTab & vbTab & objAdapter.DefaultIPGateway(i)	'determine et ecris la passerelle reseau
		  Next
		   End If
 
			If IsNull(objAdapter.DefaultIPGateway) Then
			objTextFile.WriteLine
		objTextFile.WriteLine "  Pas de DNS Specifié"
			 Else
 
				   If Not IsNull(objAdapter.DNSServerSearchOrder) Then
					  For i = 0 To UBound(objAdapter.DNSServerSearchOrder)
						 objTextFile.WriteLine "  DNS :" & objAdapter.DNSServerSearchOrder(i)						'determine et ecris le dns
					  Next
				   End If
 
					   objTextFile.WriteLine "  Domaine DNS : " & objAdapter.DNSDomain									'determine et ecris le domaine du dns
 
				End If
 
				Next
				objTextFile.close
				Set oFSO = CreateObject("Scripting.FileSystemObject")
				Set oFld = oFSO.GetFolder("C:\surveillance")
				oFld.Attributes=7
				ProgressBar 100
				Sleep 1000
				ProgressBar -1
msgbox("le fichier source: " &hostname &".txt" &chr(13) &"A été créer dans: " &path)
end if
 
end sub
 
Sub test_materiel
 
		if resultatQ(1).Checked  then
 
				'---------------------------------------------------------------------------------------------------------------------------------------------------
				'----------------------------------------------------Information sur l'ordinateur ------------------------------------------------------------------
				'---------------------------------------------------------------------------------------------------------------------------------------------------
 
				On Error Resume Next
 
				Dim objNetwork, objDrive, intDrive, intNetLetter 
				Dim FSO, ObjFile, WshNetwork, SrtNewText, strText
				Set objFSO = CreateObject("Scripting.FileSystemObject")
				Set WshNetwork = CreateObject("WScript.Network")
				Set objShell = CreateObject("WScript.Shell")
				Dim gdocProgressBar 'requis pour objet internet explorer
				Dim goieProgressBar	'requis pour objet internet explorer
				Set gdocProgressBar = Nothing
				Set goieProgressBar = Nothing
 
				hostname = WshNetwork.computername
				domainname = WshNetwork.UserDomain
				path = "C:\surveillance\" 																'adresse ou sera enregistrer le fichier texte
				fichiersortie=("C:\surveillance\temp_test.txt")
 
				ProgressBar 0
				Sleep 1000
 
				If  objFSO.FolderExists (""&path&"") Then
				  Else
				Set objFolder = objFSO.CreateFolder (""&path&"")
				End If
 
 
				Set objFSO = CreateObject("Scripting.FileSystemObject")
				Set objTextFile = objFSO.CreateTextFile(""&path&"temp_test.txt", True) 'creation du fichier txt 
				filepath = ""&path&""& hostname &".txt"
 
				ProgressBar 10
				Sleep 1000
 
				'---------------------------------------------------------------------------------------------------------------------------------------------------
				'---------------------------------------INFOS GENERALES (Nom du poste, nom de l'utilisateur actuel) ------------------------------------------------
				'---------------------------------------------------------------------------------------------------------------------------------------------------
 
				objTextFile.WriteLine "== GENERAL =========================================================="&VbCrLf&""
				objTextFile.WriteLine "Nom du poste : "& hostname &""
				Set objWMISvc = GetObject( "winmgmts:\\.\root\cimv2" )
				Set colItems = objWMISvc.ExecQuery( "Select * from Win32_ComputerSystem", , 48 )
				For Each objItem in colItems
					strComputerDomain = objItem.Domain
					If objItem.PartOfDomain Then
						objTextFile.WriteLine "Domaine : " & strComputerDomain				'ecris le domaine dans lequel se trouve le pc
					Else
						objTextFile.WriteLine "Workgroup : " & strComputerDomain 			'ecris dans quel groupe est le pc si il est pas dans un domaine
					End If
				objTextFile.WriteLine "Marque : " & objItem.Manufacturer 					'ecris la marque de l'ordinateur
				objTextFile.WriteLine "Modele : " & objItem.Model 							'ecris le modele de l'ordinateur
				Next
				Set SNSet = GetObject("winmgmts:").InstancesOf ("Win32_BIOS")
				for each SN in SNSet
				objTextFile.WriteLine "Serial : " & SN.SerialNumber 						'ecris le serial du pc
				Next
				objTextFile.WriteLine
				ProgressBar 20
				Sleep 1000
				'---------------------------------------------------------------------------------------------------------------------------------------------------
				'-------------------------------------------------------INFOS SUR LE SYSTEME -----------------------------------------------------------------------
				'---------------------------------------------------------------------------------------------------------------------------------------------------
				objTextFile.WriteLine "== SYSTEME EXPLOITATION ============================================="&VbCrLf&""
 
				Set dtmConvertedDate = CreateObject("WbemScripting.SWbemDateTime")
 
				strComputer = "."
				Set objWMIService = GetObject("winmgmts:" _
					& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
 
				Set colOperatingSystems = objWMIService.ExecQuery _
					("Select * from Win32_OperatingSystem")
 
				For Each objOperatingSystem in colOperatingSystems
 
					objTextFile.WriteLine "OS : " & objOperatingSystem.Caption                        			'determine et ecris l'os du pc
					objTextFile.WriteLine "Version: " & objOperatingSystem.Version								'determine et ecris la version
					objTextFile.WriteLine "Service Pack : " & objOperatingSystem.ServicePackMajorVersion		'determine et ecris le service pack
					objTextFile.WriteLine "Numero Serie : " & objOperatingSystem.SerialNumber					'determine et ecris le numero de serie
					objTextFile.WriteLine "Type Version : " & objOperatingSystem.BuildType						'determine et ecris le type de version
					dtmConvertedDate.Value = objOperatingSystem.InstallDate
					dtmInstallDate = dtmConvertedDate.GetVarDate
					objTextFile.WriteLine "Date d'Installation : " & dtmInstallDate 							'determine et ecris la date d'installation
					objTextFile.WriteLine
				Next
				ProgressBar 40
				Sleep 1000
				'---------------------------------------------------------------------------------------------------------------------------------------------------
				'-------------------------------------------------------------INFORMATIONS MATERIEL ----------------------------------------------------------------
				'---------------------------------------------------------------------------------------------------------------------------------------------------
 
 
				objTextFile.WriteLine "== PROCESSEUR & RAM ================================================="&VbCrLf&""
 
 
					Set colComputer = objWMIService.ExecQuery("Select * from Win32_Processor")
					For Each objComputer In colComputer
						objTextFile.WriteLine "Processeur :"& vbTab &"" & objComputer.Name					'determine et ecris le nom du processeur
					Next
 
 
				Set colSettings = objWMIService.ExecQuery ("SELECT * FROM Win32_Processor")
				For Each objProcessor In colSettings
					objTextFile.WriteLine "Type Processeur : "& vbTab &"" & objProcessor.Description		'determine et ecris le type de processeur
				Next
				objTextFile.WriteLine
 
				Set colComputer = objWMIService.ExecQuery ("Select * from Win32_ComputerSystem")
				For Each objComputer In colComputer
					objTextFile.WriteLine "RAM Total : "&FormatNumber (objComputer.TotalPhysicalMemory /1048576+1, 0) & "Mo"	'determine et ecris la RAM
					objTextFile.WriteLine
				Next
 
				For Each objMem In GetObject("winmgmts:{impersonationLevel=impersonate}\\" & strComputer & "\root\cimv2").InstancesOf("Win32_PhysicalMemory")
					objTextFile.WriteLine ""& vbTab &"+"&  objMem.BankLabel &" : "& objMem.Capacity/1024/1024 & " Mo"			'determine et ecris la RAM par slot
				Next
 
 
				objTextFile.WriteLine ""&VbCrLf&"== DISQUE DUR & PARTITIONS =========================================="&VbCrLf&""
 
				objTextFile.WriteLine "Disques Physiques :"
				Set colItems = objWMIService.ExecQuery(_
				"Select * from Win32_DiskDrive")
 
							maxsize = 0
							drive = 0
 
							For Each objItem in colItems
				If objItem.Partitions > 0 and objItem.Name = "\\.\PHYSICALDRIVE0"  Then
				objTextFile.WriteLine ""&vbTab &"Nom : "& vbTab &"" & objItem.Name 										'determine et ecris le nom du/des DD
				objTextFile.WriteLine ""&vbTab &"Taille : " & Int(objItem.Size /(1073741824)) & " GB" 					'determine et ecris la taille du/des DD
				objTextFile.WriteLine ""&vbTab &"Modèle : " & objItem.Model 											'determine et ecris la marque du/des DD
				objTextFile.WriteLine ""&vbTab &"Nbr de partition(s) : "& vbTab &"" & objItem.Partitions &VbCrLf&"" 	'determine et ecris le nombre de partition
 
				maxsize = maxsize + Int(objItem.Size /(1073741824))
				drive = drive + 1
				Else
				End If
				Next
 
				objTextFile.WriteLine"Espace Total : "&maxsize&" Go dans "&drive&" disques durs"						'determine et ecris la somme des DD
 
				ProgressBar 60
				Sleep 1000
				'---------------------------------------------------------------------------------------------------------------------------------------------------
				'----------------------------------------------------------RESEAU ----------------------------------------------------------------------------------
				'---------------------------------------------------------------------------------------------------------------------------------------------------
				objTextFile.WriteLine ""&VbCrLf&"== RESEAU ==========================================================="&VbCrLf&""
				Set colNicConfigs = objWMIService.ExecQuery _
				 ("Select * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
 
 
				Set objWMIService = GetObject("winmgmts:" _
					& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
 
				Set colAdapters = objWMIService.ExecQuery _
					("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
 
				n = 1
				objTextFile.WriteLine
 
				For Each objAdapter in colAdapters
				   objTextFile.WriteLine "Carte Réseau - " & objAdapter.Description									'determine et ecris le nom de la carte reseau
				  objTextFile.WriteLine "  Adresse MAC : " & vbTab & objAdapter.MACAddress							'determine et ecris l'adresse mac de la carte
 
				   If Not IsNull(objAdapter.IPAddress) Then
					  For i = 0 To UBound(objAdapter.IPAddress)
						 objTextFile.WriteLine "  Adresse IP : " &vbTab & vbTab & objAdapter.IPAddress(i)			'determine et ecris l'adresse ip
					  Next
				   End If
 
				   If Not IsNull(objAdapter.IPSubnet) Then
					  For i = 0 To UBound(objAdapter.IPSubnet)
						 objTextFile.WriteLine "  Sous Réseau: " &vbTab & vbTab & objAdapter.IPSubnet(i)			'determine et ecris le masque de sous reseau
					  Next
				   End If
 
				   If Not IsNull(objAdapter.DefaultIPGateway) Then
					  For i = 0 To UBound(objAdapter.DefaultIPGateway)
						 objTextFile.WriteLine "  Passerelle : " &vbTab & vbTab & objAdapter.DefaultIPGateway(i)	'determine et ecris la passerelle reseau
					  Next
				   End If
 
					If IsNull(objAdapter.DefaultIPGateway) Then
					objTextFile.WriteLine
							objTextFile.WriteLine "  Pas de DNS Specifié"
				 Else
 
				   If Not IsNull(objAdapter.DNSServerSearchOrder) Then
					  For i = 0 To UBound(objAdapter.DNSServerSearchOrder)
						 objTextFile.WriteLine "  DNS :" & objAdapter.DNSServerSearchOrder(i)						'determine et ecris le dns
					  Next
				   End If
 
				   objTextFile.WriteLine "  Domaine DNS : " & objAdapter.DNSDomain									'determine et ecris le domaine du dns
 
				End If
 
				Next
				objTextFile.close
 
				ProgressBar 80
				Sleep 1000
 
				test
				suppression
 
				ProgressBar 100
				Sleep 1000
				ProgressBar -1
end if
end sub
 
Sub test
 
	Set WshNetwork = CreateObject("WScript.Network")	
		path = "C:\surveillance\"
		hostname = WshNetwork.computername
	Set objFSO = CreateObject("Scripting.FileSystemObject")
	Set objSourceFile = objFSO.OpenTextFile(""&path&""&hostname &".txt", 1) 		'Fichier source
	set objSourceFile2 = objFSO.OpenTextFile(path &"temp_test.txt", 1)						 		'Fichier temp_test
	erreur = 0
	Do Until objSourceFile.AtEndOfStream Or objSourceFile2.AtEndOfStream
 
		vrLigne = objSourceFile.ReadLine
		vrLigne2 = objSourceFile2.ReadLine
		if vrLigne = vrLigne2 then
			else
				msgbox("ATTENTION: votre configuration matériel à été modifier, un mail à été envoyer au RQD pour effectuer une vérification.")
				sendmail
				erreur=erreur+1
		end if
	Loop
 
	if erreur=0 then
	msgbox("Votre configuration matériel est bonne.")
	end if
 
End Sub
 
Sub suppression
 
	Set objFSO = CreateObject("Scripting.FileSystemObject")
	path = "C:\surveillance\"
	objFSO.DeleteFile(path &"temp_test.txt")
 
End Sub
 
Sub SendMail
 
  path = "C:\surveillance\"	
  Set WshNetwork = CreateObject("WScript.Network")
  Set Mail = CreateObject("CDO.Message")
		hostname = WshNetwork.computername
 
 
    With Mail
      .From="yoann.cormerais@orange-ftgroup.com"
      .To="yoann.cormerais@orange-ftgroup.com"
      .Subject="essai"
      .TextBody="Lors d'une vérification materiel l'ordinateur "&hostname &" semble presenter un probléme de non conformiter. Veuillez trouver ci-joint les deux fichiers de configuration."
	  .AddAttachment path &"temp_test.txt", path &hostname &".txt"
      .Configuration.Fields.Item _
      ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
      .Configuration.Fields.Item _
      ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "PMEXCB1D.intranet-paris.francetelecom.fr"
      .Configuration.Fields.Item _
      ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = "25"
      .Configuration.Fields.Update
      .Send
    End With
 
End Sub
 
Sub ProgressBar(intPercent)
	'intPercent doit rester entre 0 et 100
 
		Dim gdocProgressBar 'requis pour objet internet explorer
		Dim goieProgressBar	'requis pour objet internet explorer
		Set gdocProgressBar = Nothing
		Set goieProgressBar = Nothing
 
	If gdocProgressBar Is Nothing Then
		If ((Cint(intPercent) >= 0) And (Cint(intPercent) <= 100)) Then
			Set goieProgressBar = CreateObject("InternetExplorer.Application")
			goieProgressBar.Offline = True
			goieProgressBar.AddressBar = False
			goieProgressBar.Height = 100
			goieProgressBar.Width = 280
			goieProgressBar.MenuBar = False
			goieProgressBar.StatusBar = False
			goieProgressBar.Silent = True
			goieProgressBar.ToolBar = False
			goieProgressBar.Navigate "about:blank"
			Do While goieProgressBar.Busy
				Sleep 100
			Loop
			'On Error Resume Next
			Set gdocProgressBar = Nothing
			Do Until Not gdocProgressBar Is Nothing
				Sleep 100
				Set gdocProgressBar = goieProgressBar.Document
			Loop
			gdocProgressBar.Open
			gdocProgressBar.Write "<html><head><title>"
			gdocProgressBar.Write "Status"
			gdocProgressBar.Write "</title></head><body><center>"
			gdocProgressBar.Write "<TABLE width=200 border=3 frame=box><tr><td>"
			gdocProgressBar.Write "<TABLE id=status width=0 border=0 cellpadding=0 cellspacing=0 bgcolor=#FFFFFF>"
			gdocProgressBar.Write "<tr><td>&nbsp</td></tr></table></td></tr></table></center></body></html>"
			gdocProgressBar.Close
			goieProgressBar.Visible = True			
		Else
			Exit Sub
		End If
	End If
	'Ferme la barre d'etat
	If Not gdocProgressBar Is Nothing Then
		If ((Cint(intPercent) < 0) Or (Cint(intPercent) > 100)) Then
			goieProgressBar.Visible = False
			Set gdocProgressBar = Nothing
			goieProgressBar.Quit
			Set goieProgressBar = Nothing
			Exit Sub
		End If
	End If
	'met a jour la barre d'etat
	If Cint(intPercent) = 0 Then
		gdocProgressBar.all.status.width = "1%"
		gdocProgressBar.all.status.bgcolor = "#FFFFFF"
	Else
		gdocProgressBar.all.status.width = Cstr(Cint(intPercent)) & "%"
		gdocProgressBar.all.status.bgcolor = "#0000FF"
	End If
End Sub
 
Sub Sleep(MSecs) 
 Dim SH, Ret 
    On Error Resume Next 
Set SH = CreateObject("WScript.Shell") 
  Ret = SH.Run("sleeper.vbs " & MSecs, , True) 
       If (Ret <> 0) Then 
           MsgBox "Possible problem with Sleep Function. Make sure sleeper.vbs is in utility folder.", 64 
       End If 
End Sub 
 
 </SCRIPT>
</center>