Jump to content
datguydev

I broke my install while playing with AutoIt; I think :X

Recommended Posts

datguydev

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,
             dev

Global $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 by datguydev

Share this post


Link to post
Share on other sites
water

Welcome to AutoIt and the forum!

  1. Define "broke all of MMC". Please be as specific as possible.
  2. 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 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
datguydev

I see nothing in your script that could break task scheduler, Event viewer,.

Unsure about etc...

Welcome to AutoIt and the forum!

  1. Define "broke all of MMC". Please be as specific as possible.
  2. 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)

K1ztPEf.png

(This forum is really nice! From quoting to inserting images, really smooth.)

Edited by datguydev
double post

Share this post


Link to post
Share on other sites
water

This looks promising to me as it describes how to solve similar problems.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
datguydev

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 by datguydev

Share this post


Link to post
Share on other sites
water

I do not see anything in your script that could cause any problems with MMCs.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
datguydev

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.

Share this post


Link to post
Share on other sites

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

×