rbenner1184 Posted November 14, 2013 Posted November 14, 2013 (edited) Hello, I have been working with Citrix to make an install package and first let me just say it has been a pain. All my script is supposed to do is check the version of citrix and either uninstall it if it is older or point to the correct server if the version is current. In order to do this though I have to modify the registry. Now I have no idea why my script will not write to the registry. This is so frusterating, because I was waiting for ever for Citrix to even get the server up to test. Any extra eyes would be appreciated. Any thoughts? Thank you. expandcollapse popup$SilentInstall = False $installDir = "C:\Admin\AppUpd" $logFile = $installDir & "\" & @ScriptName & ".log" $logFileSubApp = $installDir & "\" & @ScriptName & "_bundled_app.log" $logEntries = 0 $appTitle = "SMO Citrix Client version 13.3.0.55" $ret = 0 ;command options ; <exe> /s if $cmdLine[0] > 0 then for $a = 1 to $cmdLine[0] if StringLeft($cmdLine[$a],1) = "-" then $cmdLine[$a] = "/" & StringMid($cmdLine[$a],1) EndIf Switch $cmdLine[$a] Case "/s", "/q", "/silent", "/quiet" $SilentInstall = True EndSwitch Next EndIf ;start the log DirCreate($installDir) _Log("Log Started. SilentInstall = " & $SilentInstall) ;_CheckIfAdmin() ;not needed on most installs since the #requireadmin immediately prompts to run as admin if not $SilentInstall then ProgressOn($appTitle,"","Please Wait...",-1,-1,16) ProgressSet(50,"Please wait...","Installing") FileInstall("CitrixReceiverEnterprise.exe",$installDir & "\CitrixReceiverEnterprise.exe") ;FileInstall("CitrixClientRemoveAndReplace v1.3.vbs", $installDir & "CitrixClientRemoveAndReplace v1.3.vbs") ;install the Citrix Client if its not installed already ;its already installed, and will be uninstalled $appVersion = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\CitrixOnlinePluginFull", "DisplayVersion") If $appVersion < "13.3.0.55" Then ProgressSet(50,"Please wait...","Uninstalling") _Log("Uninstalling Citrix Receiver Enterprise " & $appVersion) RunWait("\\miappldms01\Packages\InTesting\SMOCitrixClient_POCT\ReceiverCleanupUtility.exe /s") _Log("Install returned " & $ret & ", err=" & @error & ", ext=" & @extended) ProgressSet(50,"Please wait...","Installing") _Log("Installing Citrix Receiver Enterprise " & $appVersion) RunWait('"' & $installDir & '\CitrixReceiverEnterprise.exe" /silent /includeSSON ADDLOCAL="ReceiverInside,ICA_Client,SSON,PN_Agent" ENABLE_SSON=yes SERVER_LOCATION="http://SMOCitrix.com/Citrix/PNAgent/Config.xml"',$installDir) _Log("Install returned " & $ret & ", err=" & @error & ", ext=" & @extended) ProgressSet(50,"Please wait...","Deleting files") ;Clean up the icons from the previous installs FileDelete(@DesktopCommonDir & "\SMO Windows Client on Citrix.url") FileDelete(@DesktopCommonDir & "\SMO Windows Client on Citrix.url.lnk") FileDelete(@DesktopCommonDir & "\SMO Windows Client on Citrix.lnk") run(@ComSpec & ' /c del /f /s /q "c:\SMO Windows Client on Citrix.lnk"',"c:\",@SW_HIDE) ElseIf $appVersion = "13.3.0.55" Then ProgressSet(50,"Writing to Registry") RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE \Citrix\PNAgent","ServerURL", "REG_SZ", "http://SMOCitrix.com/Citrix/PNAgent/Config.xml") ProgressSet(50,"Writing to Registry") RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Citrix\PNAgent","ServerURL", "REG_SZ", "http://SMOCitrix.com/Citrix/PNAgent/Config.xml") ;kills and will restart process ProcessClose("Receiver.exe") Run("C:\Program Files\Citrix\ICA Client\Receiver\Receiver.exe") EndIf ;set up the hosts file (DO NOT USE) ;~ FileInstall("hosts","C:\Windows\System32\drivers\etc\hosts",1) ;Configure the after install stuff like the icon and policy ;ProgressSet(80) ;_DoPostInstallOperations() ;prompt the user if not silent ProgressOff() if not $SilentInstall Then _ShowUserPrompt($ret) ;exit _Log("Exiting") exit $ret ;---------------------------------- ; FUNCTIONS ;---------------------------------- Func _SendToCore($ReturnMessage) ;this will only work if its being sent through LANDesk If FileExists("C:\Program Files\LANDesk\LDClient\sdclient.exe") Then RunWait(@ComSpec & ' /c sdclient.exe /msg="' & $ReturnMessage & '."','C:\Program Files\LANDesk\LDClient',@SW_HIDE) EndIf EndFunc Func _Log($string) $datetime = @MDAY & "/" & @MON & "/" & @YEAR & " " & @HOUR & ":" & @MIN & "." & @SEC & " - " if FileExists($logFile) AND $logEntries = 0 Then ;add a blank line if this is the first entry in the log RunWait(@ComSpec & " /c echo - >> " & $logFile,@WindowsDir,@SW_HIDE) EndIf ;add the pertinent log information RunWait(@ComSpec & " /c echo " & $datetime & $string & " >> " & $logFile,@WindowsDir,@SW_HIDE) ;increase the log entries $logEntries = $logEntries + 1 EndFunc Func _CheckIfAdmin() if not IsAdmin() Then ;Log error (if there's write ability to the install dir then this will update) _Log("Admin rights were not detected. Install will exit.") ;Display the error message if its not silent if not $SilentInstall Then MsgBox(16,"Error","You must have Administrator rights to run this.",300) EndIf exit 1625 ;This installation is forbidden by system policy. Contact your system administrator. EndIf EndFunc Func _ShowUserPrompt($returnCode) if $returnCode = 3010 then ;reboot needed $mret = MsgBox(64 + 4,$appTitle,"A reboot is required to complete this install." & @crlf & @crlf & "Would you like to reboot now?",300) if $mret = 6 Then ;Yes was clicked Shutdown(6,$appTitle & " installation") exit $returnCode EndIf ElseIf $returnCode = 0 Then ;successful install MsgBox(64,$appTitle,"Installation completed successfully.",300) ElseIf $returnCode = 1 then ;already installed MsgBox(64,$appTitle,"This software is already installed." & @crlf & @crlf & "No action was taken.",300) Else MsgBox(16,$appTitle,"There was a problem running this install. The return code was " & $returnCode & _ @crlf & @crlf & "Refer to the following log(s) for more details:" & @crlf & " " & $logFile & @crlf & " " & $logFileSubApp,300) EndIf EndFunc Func _DoPostInstallOperations() ;install the icon and link _Log("Setting up the icon for All Users") FileInstall("Seagull.ico",@WindowsDir & "\System32\Seagull.ico",1) ;FileInstall("SMO Windows Client on Citrix.url",@DesktopCommonDir & "\SMO Windows Client on Citrix.url",1) FileDelete(@DesktopCommonDir & "\SMO Windows Client on Citrix.url") FileDelete(@DesktopCommonDir & "\SMO Windows Client on Citrix.url.lnk") FileCreateShortcut("http://smoctx/Citrix/XenApp/auth/login.aspx",@DesktopCommonDir & "\SMO Windows Client on Citrix","","","",@WindowsDir & "\System32\Seagull.ico") ;set up the policy to allow citrix to run $regKey = "HKLM\Software\Microsoft\Internet Explorer\Low Rights\ElevationPolicy\{9E22DED2-1858-4511-96C4-5625F54CECCA}" RegWrite($regKey,"AppPath","REG_SZ",@ProgramFilesDir & "\Citrix\ICA Client") RegWrite($regKey,"AppName","REG_SZ","wfcrun32.exe") RegWrite($regKey,"Policy","REG_DWORD",3) ;remove the run key entry RegDelete("HKLM\Software\Microsoft\Windows\CurrentVersion\Run","ConnectionCenter") ;remove the bho that slows down ie ;CtxIEInterceptorBHO - {2C4631FF-5CC8-4EBC-A0DF-34C92291759E} ;CtxVDAIEInterceptorBHO - {A44B166E-5097-4B07-8732-BFD924C3CF68} RegDelete("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects\{2C4631FF-5CC8-4EBC-A0DF-34C92291759E}") ;RegDelete("HKLM\SOFTWARE\Classes\CLSID\{2C4631FF-5CC8-4EBC-A0DF-34C92291759E}") ;RegDelete("HKLM\SOFTWARE\Classes\IEInterceptor.InterceptorBHO") ;RegDelete("HKLM\SOFTWARE\Classes\IEInterceptor.InterceptorBHO.1") EndFunc Edited November 14, 2013 by rbenner1184
Moderators JLogan3o13 Posted November 14, 2013 Moderators Posted November 14, 2013 Exactly where is your script failing, and what error checking have you done? You say: Now I have no idea why my script will not write to the registry but don't show any error checking to help yourself (or us) determine the point of failure. Help us help you "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
rbenner1184 Posted November 14, 2013 Author Posted November 14, 2013 Thats just it there are no syntax erros that are shown. I run the Syntax Check Prod and this will tell me if i have errors. Mine seems to be a logic error. I am not sure why this will not execute the registry edit. THERE ARE NO ERRORS COMMING BACK. This is why I am confused why the changes are not beeing written.
rbenner1184 Posted November 14, 2013 Author Posted November 14, 2013 >"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /prod /AU3Check /in "Y:\Ryan\SMOCitrixClient_POCT\SMOCitrixClient_POCTest_Corrections_Version2.au3" +>15:00:54 Starting AutoIt3Wrapper v.2.1.2.9 Environment(Language:0409 Keyboard:00000409 OS:WIN_7/Service Pack 1 CPU:X64 OS:X86) >Running AU3Check (1.54.22.0) from:C:\Program Files\AutoIt3 +>15:00:54 AU3Check ended.rc:0 >Exit code: 0 Time: 0.320 Thats what I get. No errors.
Moderators JLogan3o13 Posted November 14, 2013 Moderators Posted November 14, 2013 Ok, but you STILL NEED TO DO ERROR CHECKING. You're writing out to your log file already, why not include an error checking statement after your RegWrites? 83.RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE \Citrix\PNAgent","ServerURL", "REG_SZ", "http://SMOCitrix.com/Citrix/PNAgent/Config.xml") If @error Then ;write error message to log file "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
l3ill Posted November 14, 2013 Posted November 14, 2013 Return Value Success: Returns 1. Failure: Returns 0 if error writing registry key or value. @error can be set to following values : 1 if unable to open requested key 2 if unable to open requested main key 3 if unable to remote connect to the registry -1 if unable to open requested value -2 if value type not supported My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example
Moderators JLogan3o13 Posted November 14, 2013 Moderators Posted November 14, 2013 Good addition, I always forget RegWrite is a little squirrely. The larger point stands, however; error checking needs to be done to see where the failure comes in. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
rbenner1184 Posted November 14, 2013 Author Posted November 14, 2013 14/11/2013 12:15.33 - Log Started. SilentInstall = False 14/11/2013 12:15.35 - Uninstalling Citrix Receiver Enterprise 14/11/2013 12:15.35 - Install returned 0, err=1, ext=2 14/11/2013 12:15.35 - Installing Citrix Receiver Enterprise 14/11/2013 12:16.24 - Install returned 0, err=0, ext=0 14/11/2013 12:16.31 - Exiting - 14/11/2013 12:40.18 - Log Started. SilentInstall = False 14/11/2013 12:40.25 - Exiting - 14/11/2013 12:42.50 - Log Started. SilentInstall = False 14/11/2013 12:42.53 - Exiting - 14/11/2013 12:45.38 - Log Started. SilentInstall = False 14/11/2013 12:45.40 - Exiting - 14/11/2013 12:47.37 - Log Started. SilentInstall = False 14/11/2013 12:47.41 - Exiting - 14/11/2013 13:12.48 - Log Started. SilentInstall = False 14/11/2013 13:12.49 - Exiting - 14/11/2013 15:12.02 - Log Started. SilentInstall = False 14/11/2013 15:12.02 - Install returned 0, err=1, ext=87 14/11/2013 15:12.02 - Reg Write returned0, err=0, ext=0 14/11/2013 15:12.02 - Reg Write returned0, err=0, ext=0 14/11/2013 15:12.03 - Exiting
l3ill Posted November 14, 2013 Posted November 14, 2013 (edited) Yep, Lots of strings (case sensitive) and punctuation to get wrong and they don't show up as syntax fehler...they just wont work. Edited November 14, 2013 by billo My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example
rbenner1184 Posted November 14, 2013 Author Posted November 14, 2013 Yea maybe its the case thats wrong.
rbenner1184 Posted November 14, 2013 Author Posted November 14, 2013 I still have no idea why the registry writing returns 0
Moderators JLogan3o13 Posted November 14, 2013 Moderators Posted November 14, 2013 You first need to narrow it down to which RegWrite fails first. Then, try a script where all you're doing is that function. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
l3ill Posted November 14, 2013 Posted November 14, 2013 I also would suggest using absolute paths to the reg instead of variables & macros until you get it working. My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example
rbenner1184 Posted November 14, 2013 Author Posted November 14, 2013 yea billo I was thinking that too. sometimes I find that autoit can be kind of buggy with the variables and macros.
l3ill Posted November 14, 2013 Posted November 14, 2013 Another tip is to use the context menu to get the PATH wout any mistakes choose "copy key name" My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example
rbenner1184 Posted November 14, 2013 Author Posted November 14, 2013 i made a script that only writes to the registry with this one line of code. Still the same result RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE \Citrix\PNAgent","ServerURL", "REG_SZ", "http://SMOCitrix.com/Citrix/PNAgent/Config.xml")
rbenner1184 Posted November 14, 2013 Author Posted November 14, 2013 And mind you the only thing that deoesn't work in this script is the registry edit.
rbenner1184 Posted November 14, 2013 Author Posted November 14, 2013 Is the string value backwards. This is how I always have been coding the registry write.
Moderators JLogan3o13 Posted November 14, 2013 Moderators Posted November 14, 2013 i made a script that only writes to the registry with this one line of code. Still the same result RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE \Citrix\PNAgent","ServerURL", "REG_SZ", "http://SMOCitrix.com/Citrix/PNAgent/Config.xml") I see a space between SOFTWARE and Citrix. Is that in your script, or just how you typed it? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Developers Jos Posted November 14, 2013 Developers Posted November 14, 2013 What does this return? $rc = RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\PNAgent","ServerURL", "REG_SZ", "http://SMOCitrix.com/Citrix/PNAgent/Config.xml") ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $rc = ' & $rc & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
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