#210556 - 2015-08-19 05:57 PM
Deploying Software to Computers using Kixtart
|
JSosa
Fresh Scripter
Registered: 2015-08-19
Posts: 9
Loc: Miami FL USA
|
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.
Attachments
Lync-en.txt (593 downloads) Description:
|
Top
|
|
|
|
#210557 - 2015-08-19 09:48 PM
Re: Deploying Software to Computers using Kixtart
[Re: JSosa]
|
JSosa
Fresh Scripter
Registered: 2015-08-19
Posts: 9
Loc: Miami FL USA
|
This is what I have gotten so far... Any assistance would be appreciated.
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
Edited by Glenn Barnas (2015-08-20 01:47 AM) Edit Reason: Using CODE tags will preserve your formatting!
|
Top
|
|
|
|
#210559 - 2015-08-20 01:48 PM
Re: Deploying Software to Computers using Kixtart
[Re: Glenn Barnas]
|
JSosa
Fresh Scripter
Registered: 2015-08-19
Posts: 9
Loc: Miami FL USA
|
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
|
Top
|
|
|
|
#210561 - 2015-08-20 05:06 PM
Re: Deploying Software to Computers using Kixtart
[Re: Mart]
|
JSosa
Fresh Scripter
Registered: 2015-08-19
Posts: 9
Loc: Miami FL USA
|
This is what I have come up with the compilation from both Glenn and Mart. Again many thanks for your comments
$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
Edited by Mart (2015-08-20 05:51 PM) Edit Reason: Added code tags.
|
Top
|
|
|
|
#210565 - 2015-08-21 02:04 AM
Re: Deploying Software to Computers using Kixtart
[Re: Mart]
|
Glenn Barnas
KiX Supporter
Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
|
You guys seem to have missed this - it's a more appropriate way to tell if a system is 32 or 64 bit:
$Is64 = IIf(InStr('%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%', 'AMD64'), 1, 0)
This returns 1 (true) if either the environment variables contain AMD64, and 0 (false) if they don't. These are set when running on an x64 platform by the operating system. The presence (or absence) of a directory is arbitrary - I can have a 32-bit O/S and nothing will stop me from creating a folder called "Program Files(X86)", whereupon your logic will fail.
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.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
Also, I'd use Shell instead of Run so you can continue processing and log the success or failure of the installation. You have no ability to do this with Run - @ERROR just tells you if the command started successfully, not whether it completed successfully, which is usually more important.
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
_________________________
Actually I am a Rocket Scientist!
|
Top
|
|
|
|
#210578 - 2015-08-21 08:08 PM
Re: Deploying Software to Computers using Kixtart
[Re: Allen]
|
JSosa
Fresh Scripter
Registered: 2015-08-19
Posts: 9
Loc: Miami FL USA
|
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
|
Top
|
|
|
|
#210595 - 2015-08-24 01:19 PM
Re: Deploying Software to Computers using Kixtart
[Re: Glenn Barnas]
|
JSosa
Fresh Scripter
Registered: 2015-08-19
Posts: 9
Loc: Miami FL USA
|
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
Attachments
Capture.PNG (626 downloads) Description:
|
Top
|
|
|
|
#210596 - 2015-08-24 02:47 PM
Re: Deploying Software to Computers using Kixtart
[Re: JSosa]
|
JSosa
Fresh Scripter
Registered: 2015-08-19
Posts: 9
Loc: Miami FL USA
|
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
|
Top
|
|
|
|
#210600 - 2015-08-25 07:11 PM
Re: Deploying Software to Computers using Kixtart
[Re: Mart]
|
JSosa
Fresh Scripter
Registered: 2015-08-19
Posts: 9
Loc: Miami FL USA
|
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.
|
Top
|
|
|
|
#210606 - 2015-08-26 02:00 AM
Re: Deploying Software to Computers using Kixtart
[Re: JSosa]
|
ShaneEP
MM club member
Registered: 2002-11-29
Posts: 2125
Loc: Tulsa, OK
|
Maybe need to include the full path to the config file?
IF INGROUP(Lync_USERS)
SHELL "S:\Lync\setup.exe /configure S:\Lync\configuration-en.xml"
ENDIF
|
Top
|
|
|
|
#210608 - 2015-08-26 02:16 PM
Re: Deploying Software to Computers using Kixtart
[Re: ShaneEP]
|
Glenn Barnas
KiX Supporter
Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
|
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:- Every application product has a single folder with no version or other descriptive text (eg: "Acrobat", not "Acrobat 10")
- Every product folder has a subfolder called "Current" where the currently deployed version resides. This is where the installation is run from.
- Every installation folder has an "INST.BAT" file that contains the command(s) to perform a silent install. It may accept arguments to alter the default install method, but must run with reasonable defaults without any args.
- An "Archive" folder may exist, with version-specific subfolders. Each subfolder is named after a specific version, and is configured exactly like the "Current" folder.
- A "BIN" folder in the root of SWDIST contains the KiXtart scripting engine used for deployments, KixForms.DLL, and any other tools needed by the installers.
- All references to the utilities in the Bin folder are relative (\bin\folder\utility.exe) and will not specify any drive letters.
There's a script in the root of the SWDIST folder called "install" that parses the arguments, does a CD to the product\Current folder, and invokes INST.BAT with any needed args. Since every product folder is configured exactly the same, it's easy to automate. If I need to install an older version, I specify the archive option and version, and the script runs INST.BAT from that folder instead.
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 If Exist('setup.exe')
$Cmd = 'setup.exe ' + $Args
'Running ' + $Cmd + @CRLF
Shell $Cmd
@SERROR + @CRLF
Else
'Error - setup.exe was not present!' + @CRLF
EndIf Glenn
_________________________
Actually I am a Rocket Scientist!
|
Top
|
|
|
|
#210610 - 2015-08-26 09:15 PM
Re: Deploying Software to Computers using Kixtart
[Re: Glenn Barnas]
|
JSosa
Fresh Scripter
Registered: 2015-08-19
Posts: 9
Loc: Miami FL USA
|
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
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(Allen)
and 466 anonymous users online.
|
|
|