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
| On error Resume Next
Const HKEY_LOCAL_MACHINE = &H80000002
'==Liste des postes à scanner ==
arrComputers = Array("poste1","poste3","poste4")
'==Déclaration et emplacement du fichier de sortie txt==
Set fso = CreateObject("Scripting.FileSystemObject" )
Set f = fso.OpenTextFile("c:\Vérification_Registre\Résultat.txt", 2,True)
'==Vérication de la présence du poste==
For Each strComputer In arrComputers
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
'==Gestion de l'erreur pour une ip non attribuée==
If err.number <> 0 Then
f.Write strComputer & "= poste introuvable" & vbcrlf
Else
Set colItems = objWMIService.ExecQuery ("Select Name from Win32_ComputerSystem")
For Each objItem in colItems
Next
'==Lecture de la clef de registre si le poste est présent ==
Set oReg=GetObject( _
"winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "SYSTEM\CurrentControlSet\Services\USBSTOR"
strValueName = "Start"
oReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
f.Write strComputer & "=" & dwValue & vbcrlf
For Each objComputer in colSettings
Next
End If
err.clear
Next
'==Message pour avertir que la vérification est finie ==
WScript.Echo "Vérification OK" |
Partager