Jump to content

Recommended Posts

Posted

Hi,

I want to create a script to resolve profil.bak issue on Windows 7.

My problem is how to do a search of the registry key from the user name.

Registry key for exemple: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\S-1-5-21-4138206758-3315363207-xxxxxxxx-xxxx.bak.

After i want to rename this key.

  • Moderators
Posted

Guiguit59,

Welcome to the AutoIt forums.

But please pay attention to where you post - the "AutoIt Technical Discussion" section where you started this thread is not for general support questions.  I have moved it for you, but would ask you to be more careful in future.

M23

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

Try this example :

For $i = 1 To 10
    $var = RegEnumKey("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList", $i)
    If @error <> 0 Then ExitLoop
    MsgBox(4096, "SubKey #" & $i & " under HKLM\Software: ", $var)
Next

Then Check out the other REG examples like RegWrite()

Posted

I actually already wrote something for this, it's probably not as awesome as other coders can put together and I could do better now since I have gotten better at this but at-least its an example you can build from. 

 

#RequireAdmin
$sPath = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList"


RunWait(@ComSpec & ' /c REG EXPORT "' & $sPath & '" C:\BeforeProfileFix.reg /f')

For $i = 1 To 40

    $sub = RegEnumKey($sPath, $i)

        If @error Then ExitLoop

        If StringInStr($sub, ".bak") Then
            RunWait(@ComSpec & ' /c REG DELETE "' & $sPath & '\' & StringTrimRight($sub, 4) & '" /f')
            Sleep(200)
            RunWait(@ComSpec & ' /c REG COPY  "' & $sPath & '\' & $sub & '" "' & $sPath & '\' & StringTrimRight($sub, 4) & '" /s')
            Sleep(200)
            RunWait(@ComSpec & ' /c REG DELETE "' & $sPath & '\' & $sub & '" /f')
        Else
            EndIf


Next

MsgBox(0, "BoCC Automation", "Profile Fix has been implimented" & @CRLF & @CRLF & "A copy of the registry is saved to C: if you need to restore old settings" & @CRLF & "Please reboot the machine to have changes take effect")
$Reboot = MsgBox(4, "BoCC Automation", "Reboot Now?")
If $Reboot = 6 Then Shutdown(6)

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...