datguydev Posted July 8, 2015 Posted July 8, 2015 (edited) Greetings, Recently, I've decided to pick up AutoIt and it's been really a fun language to learn. My last script was to simply backup my broswer's bookmarks for safe keeping while learning a bit how files can be manipulated. Heavy use of system and env. variables. However, something that I did with the script below, broke all of MMC (task scheduler, Event viewer, etc.) functionality on my Windows 7 x64 install. I'm new around here, but not to computing or programming. I'm an IT undergrad and I'm proficient with other scripting languages such as Python, Bash. Known to dabble in Java and PHP. I went through and tested every solution available for this MMC issue and nothing fixed it. It took a week, because it would take me 6 hours of backing up to migrate to a new install. Eventually, I had to submit as I use those tools on the daily. Really important, I can't confirm the script below broke it. But given the time frame of what actions occurred before and after making the script and when the issue popped up. I'd say it's extremely likely the culprit. The commands that are in the script are the only that were used. I didn't set or delete env. variables. Worth noting the script was more complicated and 'proper.' Had to remove a bunch of functions to find I mispelled a directory But same content. I'm really hesitant to run this script or attempt another. Just throwing it out there to see if anyone can pick up on what could have caused the MCC issue. Best regards, devexpandcollapse popupGlobal $booksDir = @UserProfileDir & "\Dropbox\Safe\Bookmarks\" Global $chromeDir = FileExists(@LocalAppDataDir & "\Google\Chrome\User Data\Default\Bookmarks") Global $firefoxDir = FileExists(@AppDataDir & "\Mozilla\Firefox\Profiles\7hx26jbg.default\places.sqlite") Global $operaDir = FileExists(@AppDataDir & "\Opera Software\Opera Stable\Bookmarks") Global $logDir = FileExists(@ScriptDir & "\log.txt") Func Debug($i) ConsoleWrite($i & @CRLF) if $logDir = True Then Local $log = @ScriptDir & "\log.txt" $hwd = FileOpen($log, 1) FileWriteLine($hwd, $i) EndIf EndFunc Debug( @CRLF & @CRLF & "Start - > " & @MDAY & @HOUR & @MIN & " < - Start") if $chromeDir = True Then Backup(1) EndIf if $firefoxDir = True Then Backup(2) EndIf if $operaDir = True Then Backup(3) EndIf Func Backup($x) Local $name = "" Local $file1 = "" ;; Switch $x Case 1 Local $name = "Bookmarks_chrome" Local $file1 = @LocalAppDataDir & "\Google\Chrome\User Data\Default\Bookmarks" Debug("Chrome backed up") Case 2 Local $name = "places.sqlite_firefox" Local $file1 = @AppDataDir & "\Mozilla\Firefox\Profiles\7hx26jbg.default\places.sqlite" Debug("Firefox backed up") Case 3 Local $name = "Bookmarks_opera" Local $file1 = @AppDataDir & "\Opera Software\Opera Stable\Bookmarks" Debug("Opera backed up") EndSwitch ;SET - Backup Local $file2 = $booksDir & $name Local $file2Check = FileExists($file2) FileCopy($file1, $file2, 1) Sleep(500) EndFunc Exit Edited July 8, 2015 by datguydev
JohnOne Posted July 8, 2015 Posted July 8, 2015 I see nothing in your script that could break task scheduler, Event viewer,. Unsure about etc... AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
water Posted July 8, 2015 Posted July 8, 2015 Welcome to AutoIt and the forum!Define "broke all of MMC". Please be as specific as possible.You call FileOpen every time you run function Debug. You only need to call FileOpen once in your script. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
datguydev Posted July 8, 2015 Author Posted July 8, 2015 (edited) I see nothing in your script that could break task scheduler, Event viewer,.Unsure about etc...Welcome to AutoIt and the forum!Define "broke all of MMC". Please be as specific as possible.You call FileOpen every time you run function Debug. You only need to call FileOpen once in your script.MMC.exe. (https://en.wikipedia.org/wiki/Microsoft_Management_Console)The windows error was "mmc could not create the snap-in. CLSID: FX:{xxxxxxx-d6aa-41d9-a205-xxxxxxxxxxxx} error." Where the xxxxxxx would change depending on which snap-in I tried to use.What was affected was anything from the top of the list - to the end; all that is. It was one of those frustrating cases where the online solution worked for everyone else, but not for me. Checked system files. Forcibly refreshed MMC and .NET files. Reinstall. Change the version of .NET MMC snap-ins use in the registry. System restore. Thanks for the heads up on FileOpen. :] It did work, but ... (facepalm)(This forum is really nice! From quoting to inserting images, really smooth.) Edited July 8, 2015 by datguydev double post
water Posted July 8, 2015 Posted July 8, 2015 This looks promising to me as it describes how to solve similar problems. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
datguydev Posted July 8, 2015 Author Posted July 8, 2015 (edited) This looks promising to me as it describes how to solve similar problems.Threads like that were my life for that particular week.Does that thread help you find a symptom which relates to the code? Most of them have to do with .NET, Edited July 8, 2015 by datguydev
water Posted July 8, 2015 Posted July 8, 2015 I do not see anything in your script that could cause any problems with MMCs. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
datguydev Posted July 8, 2015 Author Posted July 8, 2015 I do not see anything in your script that could cause any problems with MMCs.Nonetheless, thank you for looking at my problem. For what it is worth, one thing I forgot to mention is I put this script into task scheduler. (Sorry it's been awhile since.) For example, I'd have this script run maybe once every other day for obvious backup purposes.
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