Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

psexec and regread

$
0
0
Hello,

I compiled a script on a 64-bit computer, and the script is not working properly on 32-bit computers. Here's what I'm trying to do... We are, as a university, switching from Symantec to Microsoft Forefront Endpoint Protection. However, on some machines, Symantec is failing to remove through the use of our SCCM server. Instead, I am using psexec to run this script which finds the GUID of Symantec, initiates an msiexec uninstall, and then installs Forefront. If run on a 64-bit test machine, it seems to work flawlessly. However, every 32-bit machine I've pushed the script to does not remove Symantec. I'm assuming this is because it isn't reading the registry for the GUID properly. Any thoughts? I'm spinning up a 32-bit Windows 7 machine right now for some testing of my own. But if anyone has any input, I'd really appreciate it.


; Find the GUID for Symantec
$index = 1
$GUID = ""

If @OSArch="X86" Then
$keyroot = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
Else
$keyroot = "HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
EndIf

$subkey = "***START***"; we use this because "" will make our While loop exit
While $subkey <> ""
$subkey = RegEnumKey($keyroot, $index)

If StringInStr(RegRead($keyroot & "\" & $subkey, "DisplayName"), _
"Symantec") Then
$GUID = $subkey ; Record the GUID
$subkey = "" ; Force the While to exit
EndIf

$index = $index + 1
WEnd

If $GUID <> "" Then
ShellExecuteWait('msiexec',"/qn /X" & $GUID & " /norestart")
Sleep(30000)
RunWait("\\server\share\Forefront Protection\FEPInstall(" & @OSArch & ").exe /q /s")
EndIf


Viewing all articles
Browse latest Browse all 12506

Trending Articles