[VBS] Supprimer une clé de registre

Résolu/Fermé
Strom26 Messages postés 3 Date d'inscription vendredi 22 juin 2007 Statut Membre Dernière intervention 26 juin 2007 - 22 juin 2007 à 13:30
Strom26 Messages postés 3 Date d'inscription vendredi 22 juin 2007 Statut Membre Dernière intervention 26 juin 2007 - 26 juin 2007 à 11:55
Bonjour a tous,

Etant novice en programmation, j'aurais besion de votre aide.
Mon probleme est le suivant :

je dois trouver une ligne de code en VBS pour supprimer une clé dans le registre

exemple :

le nom de la clé que je voudrais effacer : HKEY_USERS\S-1-5-18\Control Panel\Colors ( c'est juste pour exemple )

je voudrais donc pouvoir effacer la clé/dossier Colors ainsi que ceux qu'il contient.


ps : j'ai absolument besoin d'une ligne de code en VBS pas de soft ou autre langage

Merci !
A voir également:

4 réponses

Strom26 Messages postés 3 Date d'inscription vendredi 22 juin 2007 Statut Membre Dernière intervention 26 juin 2007 12
26 juin 2007 à 11:55
Merci pour ton aide, j'ai résolus mon problème :)

-----------------------------------------------------------

Dim WshShell,pKey

Set WshShell = WScript.CreateObject("WScript.Shell")

pKey = "HKEY_LOCAL_MACHINE\SOFTWARE\test\"

WshShell.RegDelete pKey

-----------------------------------------------------------

Voila les lignes de commande pour supprimer une clé dans la base de registre.
10
dubcek Messages postés 18718 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 22 mars 2024 5 615
24 juin 2007 à 14:16
1
dubcek Messages postés 18718 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 22 mars 2024 5 615
22 juin 2007 à 13:52
Là http://www.laboratoire-microsoft.org/scripts/7681/


Supprimer une clé de registre
Par Joachim GOMARD, LABORATOIRE SUPINFO DES TECHNOLOGIES MICROSOFT
Publiée le 27/10/2004 vers 13h.
Description :
Ce script VBS permet de supprimer une clé de registre.

Script :

Const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "."

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Test"

oReg.DeleteKey HKEY_LOCAL_MACHINE, strKeyPath
0
Strom26 Messages postés 3 Date d'inscription vendredi 22 juin 2007 Statut Membre Dernière intervention 26 juin 2007 12
22 juin 2007 à 15:11
merci pour ton aide mais, chez moi le script ne marche pas pourtant je suis bien en admin sur ma machine.

Voici mon script :

Const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "."

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Microsoft\test"

oReg.DeleteKey HKEY_LOCAL_MACHINE, strKeyPath

-------------------------------------------------------------------------------

je n'ai editer que cette ligne : strKeyPath = "SOFTWARE\Microsoft\test"
la seul ligne a editer ? ou ai-je fait une autre erreur ?

Merci !
0