Script VBS pour suppression de compte exchange (outlook exchange 2003 (xp , W7))
Bonjour, j'ai un petit problème, je ne m'y connais que très très peu en vbs, etant plus orienté php, java ... mais je dois faire face à un problème en vbs qui je pense n'est pas trop compliqué à résoudre quand on s'y connait.
Je souhaite supprimer les comptes de messagerie outlook pour l'utilisateur courant et j'ai donc pensé au script vbs. J'ai trouvé ceci sur internet mais quand j'execute le script cela ne fonctionne pas.
Code:
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
| Option Explicit
' déclaration des variables
Dim oReg
Dim arrValues, arrBytes
Dim strValue, strId
Dim strSubKey: strSubKey = _
"Software\Microsoft\Windows NT\CurrentVersion\" & _
"Windows Messaging Subsystem\Profiles\Outlook\" & _
"9375CFF0413111d3B88A00104B2A6676"
' définition des constantes
Const HKCU = &H80000001
' initialisation des objets
Set oReg = GetObject ("winmgmts:/root/default:stdregprov")
' lecture des valeurs
oReg.EnumValues HKCU, strSubKey, arrValues
For Each strValue In arrValues
' traitement des clsid
If Left (strValue, 1) = "{" Then
' lecture des id (Big-endian)
oReg.GetBinaryValue HKCU, strSubKey, strValue, arrBytes
If UBound (arrBytes) = 3 Then
' formatage de l'id (Little-endian)
strId = _
Left ("00",2-Len(Hex(arrBytes(3)))) & Hex(arrBytes(3)) & _
Left ("00",2-Len(Hex(arrBytes(2)))) & Hex(arrBytes(2)) & _
Left ("00",2-Len(Hex(arrBytes(1)))) & Hex(arrBytes(1)) & _
Left ("00",2-Len(Hex(arrBytes(0)))) & Hex(arrBytes(0))
' les comptes par défaut sont épargnés
If CInt ("&H" & strId) > 2 Then
' suppression des comptes
oReg.DeleteValue HKCU, strSubKey, strValue
oReg.DeleteKey HKCU, strSubKey & "\" & strId
End If
End If
End If
Next |
Ai je quelque chose de particulier a faire a ce code ? dois je l'imbriquer dans un autre fichier ? Je vous remercie énormément si vous pouviez m'aider.