|
|
|||||||
I was wondering if you guys can assist in pointing me in the right direction to install software via kixtart. I have it working in batch and will provide what i have below to see if its possible to translate it to kixtart. I would like it to be to install it to users in a specific group, to check if computer is a x86 or x64. |
||||||||
|
|
|||||||
This is what I have gotten so far... Any assistance would be appreciated. Code: BREAK ON CLS ;$windir = READVALUE('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion','SystemRoot') $systemdrive = SUBSTR($windir,1,2) ; -- This will show C: or M: or what drive Windows is installed on $PathString = 'S:\Lync' IF INGROUP (Lync_USERS) IF EXIST ($systemdrive+'\Program Files (x86)') GOTO "64Bit" ELSE GOTO "32Bit" ELSE GOTO "END" :64Bit IF EXIST ($systemdrive+'\program files\microsoft office 15\root\office15\lync.exe') ? "This is 64bit OS" SLEEP 3 'Lync is being installed. Please wait..' SLEEP 3 ;CD \\usmiadc01\Software$\Lync\ RUN "$PathString\setup.exe /configure configuration-en-64.xml" ELSE GOTO "END" ENDIF :32Bit IF EXIST ($systemdrive+'\program files\microsoft office 15\root\office15\lync.exe') ? "This is 32bit OS" SLEEP 3 'Lync is being installed. Please wait..' SLEEP 3 ;CD \\usmiadc01\Software$\Lync\ RUN "$PathString\setup.exe /configure configuration-en-64.xml" RETURN ELSE GOTO "END" ENDIF ENDIF ENDIF :END Exit |
||||||||
|
|
|||||||
Welcome to KORG! Goto and GoSub are long-time deprecated - here's an example without: Code: $SystemDrive = Left('%WINDIR%', 2) $InstRoot = 'S:\Lync\' $Is64 = IIf(InStr('%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%', 'AMD64'), 1, 0) If InGroup('Lync_Users') ; OK to Instal Lync ; set the installer based on the platform bitness If $Is64 ; running on x64 platform $Install = 'setup.exe /configure configuration-en-64.xml' Else $Install = 'setup.exe /configure configuration-en-86.xml' EndIf ; run the installer 'Running: ' $InstRoot $Install @CRLF ; Shell $InstRoot + $Install Else 'No Lync for you!' @CRLF EndIf Glenn |
||||||||
|
|
|||||||
Thanks Glenn, Ill try your suggestions on my test VM's before pushing out to Production site. Is there away to check if the Lync program is already installed before it checks which OS version |
||||||||
|
|
|||||||
You could do something like this: Code: If Not Exist("c:\lync_install_folder\lync_executable.exe") ; Install script goes here Else ? "Lync already installed" EndIf This is just an example. You need to fix the path and exe name to fit your situation but I guess that is obvious. |
||||||||
|
|
|||||||
This is what I have come up with the compilation from both Glenn and Mart. Again many thanks for your comments Code: $systemdrive = SUBSTR($windir,1,2) ; -- This will show C: or M: or what drive Windows is installed on $InstRoot = '\\usmiadc01\Software$\Lync\' $Is64 = If($systemdrive+'\Program Files (x86)') If InGroup('Lync_Users') If Not Exist $systemdrive+'\program files\microsoft office 15\root\office15\lync.exe') OK to Install Lync Else ; set the installer based on the platform bitness If $Is64 ; running on x64 platform $Install = '\setup.exe /configure configuration-en-64.xml' Else $Install = 'setup.exe /configure configuration-en.xml' EndIf ; run the installer 'Running: ' $InstRoot $Install @CRLF ;RUN $InstRoot + $Install Else ?"Lync already installed" EndIf Else 'No Lync for you!' @CRLF EndIf But im still getting a syntax error when I call it |
||||||||
|
|
|||||||
Originally Posted By: JSosa .... im still getting a syntax error when I call it Probably because there is a lot of incorrect code in there. Below is a corrected version but I may have missed something cause I'm actually busy doing something else and I did not test it. Code: $systemdrive = SubStr($windir, 1, 2) ; -- This will show C: or M: or what drive Windows is installed on $InstRoot = '\\usmiadc01\Software$$\Lync\' If Exist($systemdrive + '\Program Files (x86)') $Is64 = "yes" EndIf If InGroup('Lync_Users') If Not Exist($systemdrive + '\program files\microsoft office 15\root\office15\lync.exe') ? "OK to Install Lync" Else ; set the installer based on the platform bitness If $Is64 = "yes" ; running on x64 platform $Install = '\setup.exe /configure configuration-en-64.xml' Else $Install = 'setup.exe /configure configuration-en.xml' EndIf ; run the installer ? 'Running: ' + $InstRoot $Install ;RUN $InstRoot + $Install Else ? "Lync already installed" EndIf Else ? 'No Lync for you!' EndIf |
||||||||
|
|
|||||||
You guys seem to have missed this - it's a more appropriate way to tell if a system is 32 or 64 bit: Code: $Is64 = IIf(InStr('%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%', 'AMD64'), 1, 0) JSosa - note the extra "I" in the statement - it's an "Immediate If" and works much like an IF in Excel - IIf(test,true_value,false_value). So - if "AMD64" is found in the string that's comprised of the two environment variables, it returns 1, otherwise returns 0. It's the only way to return a value from an IF statement. The code example I posted should work with minor modifications to the values in the $Install definitions. I changed the InGroup to reference "Domain Users" and it worked on both 32 and 64 bit platforms, and when using the Lync Users group (which I don't have) it displayed "No Lync for you!". Here's the code updated to prevent the install if it already exists - just change the $Install variable definitions and the If Exist() path specifications to meet your needs. Code: Break On $SystemDrive = Left('%WINDIR%', 2) $InstRoot = 'S:\Lync\' $Is64 = IIf(InStr('%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%', 'AMD64'), 1, 0) $Install = '' ; default is to not install If InGroup('Domain Users') ; OK to Instal Lync ; set the installer based on the platform bitness, but only if the appropriate ; Lync version is not already installed If $Is64 ; running on x64 platform If Not Exist(Path_to\64-bit\Lync) $Install = 'setup.exe /configure configuration-en-64.xml' EndIf Else If Not Exist(Path_to\32-bit\Lync) $Install = 'setup.exe /configure configuration-en-86.xml' EndIf EndIf ; run the installer only if it was defined above. If not defined, it's already here! If $Install 'Running: ' $InstRoot $Install @CRLF ; Shell $InstRoot + $Install Else 'Lync is already installed!' @CRLF EndIf Else 'No Lync for you!' @CRLF EndIf Check out my Kix UDF library, which is updated nightly (using Kix!) with the latest versions of all my functions. I do a lot of commercial systems management development with Kix and you'll find a lot of useful functions there. Glenn |
||||||||
|
|
|||||||
@onwow64 works too Glenn |
||||||||
|
|
|||||||
Really appreciate your help gentlemen. I tested it and it runs beautifully just running into an error on the actual install. I am able to run the setup.exe manually with no problem but when I get to the run the script it gets an error. Could there be a syntax that I'm missing when calling the installation file to run with the configuration file. I also tried manually entering the path of the setup file instead of calling it from the string variables |
||||||||
|
|
|||||||
there are so many errors that with the diagnosing information you provided, the cause can be a hicks boson hitting your power supply every time computer tries to install the software. for a more specific diagnosis, you would need to provide a bit more detail. |
||||||||
|
|
|||||||
Add an "@ERROR @CRLF" line after your Shell command - then post the results of the "Running" and @ERROR lines. When the script says "Running: S:\Lync\setup.exe", manually list the directory of S:\Lync and see if the setup.exe and the XML files are indeed present. Try running the command that the script says it's going to run - does it work or report an error? Finally, is the S: drive available when the script is run? Glenn |
||||||||
|
|
|||||||
This is the error that I am getting when I run the code. But when I run it manually it runs fine and installs the lync program. is there a way where it can temporarily map the drive just to make sure that its being connected |
||||||||
|
|
|||||||
I have gone to the extreme of just trying to run the setup.exe part of the script and got an error still when it installs. Sort of like its not reading the configuration xml IF INGROUP (Lync_USERS) SHELL "'S:\Lync\setup.exe /configure configuration-en.xml" ENDIF exit .... So after researching n the sight I tried this but now am getting a syntax error. AM I writing the command correctly? IF INGROUP (Lync_USERS) SHELL "\\S:\Lync\setup.exe" /q /i "\\S:\Lync\ configuration-en.xml" ENDIF exit |
||||||||
|
|
|||||||
Quote: .... .... So after researching n the sight I tried this but now am getting a syntax error. AM I writing the command correctly? Code: IF INGROUP (Lync_USERS) SHELL "\\S:\Lync\setup.exe" /q /i "\\S:\Lync\ configuration-en.xml" ENDIF exit No not really. You point to the S drive so the \\ in front is useless. Or point to a drive or point to a UNC path. A mix of both will not work. The command to be executed by Shell should be completely enclosed by quotes. If the Shell line needs quotes to preserve spaces or something then you can use single quotes for Kix and double for the command line like Shell '"\\server\share\do something.exe /q"' for example. The outer quotes will be stripped and the rest will be executed by Shell. |
||||||||
|
|
|||||||
I have tried that and still getting that error. It seems as it doesn't read the configuration.xml however when I manually run the setup.exe /configure configuration-en.xml and is able to install with no problem. |
||||||||
|
|
|||||||
Maybe need to include the full path to the config file? Code: IF INGROUP(Lync_USERS) SHELL "S:\Lync\setup.exe /configure S:\Lync\configuration-en.xml" ENDIF |
||||||||
|
|
|||||||
We do extensive OTN application deployments with our Kix-based SWDIST package. The one thing that I believe makes it so successful is that we map a drive to the root of the install folder, connect to the drive, and then CD to the folder that contains the installer and all required files and execute it from there. When we referenced drives or UNC paths, we had no end of issues with consistency and reliability. SWDIST is 90% rules and 10% code:
Using this method, its easy to install apps with minimal effort: Install the current version of Acrobat: Install Acrobat Install an archived version of Acrobat: Install Acrobat -a:9.1 When this was deployed at the Fed, we achieved a 94% delivery and installation success rate with thousands of deployments. This compared quite favorably to the Tivoli Software Distribution (barely 61% success) and Microsoft SMS (around 78%), mostly because of the consistency of the deployment structure. I've also deployed this to large organizations with hundreds of sites and configured deployments for all kinds of applications, updates, and even MS service packs and hotfixes. So - instead of running "S:\Lync\...", map the drive, CD to the folder on that drive, and then run the installer. You can verify that the file exists before execution Code: If Exist('setup.exe') $Cmd = 'setup.exe ' + $Args 'Running ' + $Cmd + @CRLF Shell $Cmd @SERROR + @CRLF Else 'Error - setup.exe was not present!' + @CRLF EndIf |
||||||||
|
|
|||||||
Would like to thank everyone who contributed and assisted with this matter. I have tested the way ShaneEP suggested and it worked fine. I was trying the code but had quotes nested inside the Shell and that was the problem all along. Finally got the code working successfully |
||||||||
|
|
|||||||
user post above was deleted. |
||||||||
|
|
|||||||
Just in case this ever gets googled. Fasttrackscripts is malware |
||||||||
|
|
|||||||
Should just delete his post. |
||||||||
|
|
|||||||
Agreed Arend - post was removed. |