Bregan Posted September 21, 2009 Share Posted September 21, 2009 I'm having trouble getting a correct error response from using RegEnumKey, or if I try to read a specific value. Below, I'm checking for 3 different citrix client installs. The first one, I just want to check to see if the key is there, if it is, do the runas below, if not, continue. For some reason, even if the key is there, the error returns -1. I tried to do it a different way with the new client install. I'm having it check for a specific key, if it exists to exit. However, even though it exists (and It is returning the correct value), it does not exit, but continues with the script. What am I missing here? expandcollapse popupLocal $sUserName = "user" Local $sPassword = "pass" Local $sDomain = "domain" Local $sProgram1 = "msiexec.exe /x {B2AE44CB-2AAB-4C08-A54B-D264BD604DA8}" Local $sProgram2 = "msiexec.exe /x {E89956F9-5B89-470E-818D-BD46102D0A01}" Local $sProgram3 = "msiexec.exe /i \\192.168.15.2\apps\XenAppHosted.msi" ;Close existing processes ProcessClose ( "pnamain.exe" ) ProcessClose ( "wfica32.exe" ) ProcessClose ( "CdfSvc.exe" ) ProcessClose ( "ssonsvr.exe" ) ProcessClose ( "wfcrun32.exe" ) ProcessClose ( "pn.exe" ) ProcessClose ( "msiexec.exe" ) ProcessClose ( "pnagent.exe" ) ; Removes old version of Citrix RegEnumKey ( "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{B2AE44CB-2AAB-4C08-A54B-D264BD604DA8}", 1) If @Error = 0 Then RunAs ($sUserName, $sDomain, $sPassword, 0, $sProgram1) WinWait ( "Windows Installer" ) Send ( "y" ) WinWaitClose ( "Citrix Presentation Server Client" ) EndIf RegEnumKey ( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\{E89956F9-5B89-470E-818D-BD46102D0A01}", "" ) If @Error = 0 Then RunAs ($sUserName, $sDomain, $sPassword, 0, $sProgram2) WinWait ( "Windows Installer" ) Send ( "y" ) WinWaitClose ( "Citrix Presentation Server Client" ) EndIf ; Installs new version of Citrix if it doesn't exist $var3 = RegRead ( "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\{388C130B-0079-46B4-A0D5-DC2DD7A89A7B}", "DisplayVersion") If $var3 = "11.0.0.5357" Then Exit RunAs ($sUserName, $sDomain, $sPassword, 0, $sProgram3) WinWait ( "Citrix XenApp Plugin for Hosted Apps Installation", "Click Finish to exit Setup." ) Send ( "{ENTER}" ) Link to comment Share on other sites More sharing options...
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