'############## Edi Pfisterer -- 3/5/2011 -- regKey löschen / Profil umbenennen ############## on Error resume next Set WshShell = WScript.CreateObject("WScript.Shell") Set objFSO = CreateObject("Scripting.FileSystemObject") anzahl = 0 Set fs = CreateObject("Scripting.FileSystemObject") const HKEY_LOCAL_MACHINE = &H80000002 strComputer = "." Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\"&_ strComputer & "\root\default:StdRegProv") strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys For Each subkey In arrSubKeys if instr(right(subkey,3),"bak") >=1 then anzahl = anzahl+1 Profilpfad_ = WshShell.RegRead("HKEY_LOCAL_MACHINE\" & strKeyPath & "\" & subkey & "\" & "ProfileImagePath") WshShell.RegDelete "HKEY_LOCAL_MACHINE\" & strKeyPath & "\" & subkey & "\" befehl = "rename """ & profilpfad_ & """ """ & replace(right(profilpfad_,10),"\","_") & "_bak""" betroffene_profile = betroffene_profile & profilpfad_ & vbcrlf WshShell.Run "cmd /c " & befehl end if Next WScript.Echo "Es wurden " & anzahl & " Profile ""repariert"" " & vbcrlf & betroffene_profile