Jump to content

Compiled x86 script does not work, the x64 does it


Recommended Posts

Hi,

I have a very simple script which has some RegRead commands in it.

I have used them often before ago but sind a few weeks I have some problems with it.

Operating System Win 7 x64 SP#1

AutoIt Version 3.3.6.1

When I run the script with SciTE (F5) it does not work.

When I compile the script for x86 the .exe does not work.

When I compile the script for x64 the .exe does work.

Did an uninstall of AutoIt and a new install, the same problem.

I am very confused.

Has anybody an idea what can I do or check?

$ScriptName     = "Forefront Client Security Uninstaller"



; Microsoft Operations Manager 2005-Agent deinstallieren
If (@OSArch = "X64") Then
    $string = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{F692770D-0E27-4D3F-8386-F04C6F434040}", "DisplayName")
EndIf

If (@OSArch = "X86") Then
    $string = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{F692770D-0E27-4D3F-8386-F04C6F434040}", "DisplayName")
EndIf


; Wert überprüfen
$pos = StringInStr($string, "Microsoft Operations Manager 2005-Agent")
If ($pos = 1) Then
    $CheckRegistry = True
Else
    $CheckRegistry = False
EndIf

; Uninstall aufrufen
If ($CheckRegistry = True) Then
  MsgBox(64, $ScriptName, "Microsoft Operations Manager 2005-Agent wird deinstalliert", 3)
    RunWait('msiexec /qb /x {F692770D-0E27-4D3F-8386-F04C6F434040}')
    MsgBox(64, $ScriptName, "Microsoft Operations Manager 2005-Agent wurde deinstalliert", 3)
EndIf

Sleep (1000)



; Microsoft Forefront Client Security-Antimalwaredienst deinstallieren
$string = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{4D4FC0FF-F197-401F-842E-E118F1D2647E}", "DisplayName")

; Wert überprüfen
$pos = StringInStr($string, "Microsoft Forefront Client Security-Antimalwaredienst")
If ($pos = 1) Then
    $CheckRegistry = True
Else
    $CheckRegistry = False
    MsgBox(64, $ScriptName, "Microsoft Forefront Client Security-Antimalwaredienst konnte nicht in der Registry gefunden werden")
EndIf

; Uninstall aufrufen
If ($CheckRegistry = True) Then
  MsgBox(64, $ScriptName, "Microsoft Forefront Client Security-Antimalwaredienst wird deinstalliert", 3)
    RunWait('msiexec /qb /x {4D4FC0FF-F197-401F-842E-E118F1D2647E}')
    If (WinExists("Microsoft Forefront Client Security-Antimalwaredienst", "Die folgenden Anwendungen sollten geschlossen werden")) Then
        ControlClick("Microsoft Forefront Client Security-Antimalwaredienst", "Die folgenden Anwendungen sollten geschlossen werden", "Button1")
    EndIf
    MsgBox(64, $ScriptName, "Microsoft Forefront Client Security-Antimalwaredienst wurde deinstalliert", 3)
EndIf

Sleep (1000)



; Microsoft Forefront Client Security State Assessment Service deinstallieren
$string = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5343BE4E-B247-41D0-B81D-4E7C55460910}", "DisplayName")

; Wert überprüfen
$pos = StringInStr($string, "Microsoft Forefront Client Security State Assessment Service")
If ($pos = 1) Then
    $CheckRegistry = True
Else
    $CheckRegistry = False
    MsgBox(64, $ScriptName, "Microsoft Forefront Client Security State Assessment Service konnte nicht in der Registry gefunden werden")
EndIf

; Uninstall aufrufen
If ($CheckRegistry = True) Then
  MsgBox(64, $ScriptName, "Microsoft Forefront Client Security State Assessment Service wird deinstalliert", 3)
    RunWait('msiexec /qb /x {5343BE4E-B247-41D0-B81D-4E7C55460910}')
    MsgBox(64, $ScriptName, "Microsoft Forefront Client Security State Assessment Service wurde deinstalliert", 3)
EndIf
Link to comment
Share on other sites

Checking @OSArch is your problem, that just doesn't make sense the way you're doing it. You want @AutoItX64.

Also using two If's to do ones work is pointless.

All those extra brackets you have in every If isn't necessary either.

Try it like this instead:

If @AutoItX64 = 1 Then
    $string = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{F692770D-0E27-4D3F-8386-F04C6F434040}", "DisplayName")
Else
    $string = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{F692770D-0E27-4D3F-8386-F04C6F434040}", "DisplayName")
EndIf

Edit: Actually I'm not sure what you want to do (all your If's are still "wrong" (for one reason or another) though).

Edited by AdmiralManHairAlkex
Link to comment
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
 Share

  • Recently Browsing   0 members

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