Guiguit59 Posted May 17, 2016 Posted May 17, 2016 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 Melba23 Posted May 17, 2016 Moderators Posted May 17, 2016 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 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Juvigy Posted May 17, 2016 Posted May 17, 2016 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()
ViciousXUSMC Posted May 17, 2016 Posted May 17, 2016 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)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now