Page 1 of 2 12>
Topic Options
#210556 - 2015-08-19 05:57 PM Deploying Software to Computers using Kixtart
JSosa Offline
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 Offline
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.



 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




Edited by Glenn Barnas (2015-08-20 01:47 AM)
Edit Reason: Using CODE tags will preserve your formatting!

Top
#210558 - 2015-08-20 01:57 AM Re: Deploying Software to Computers using Kixtart [Re: JSosa]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
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
Installs either version depending on the platform, only if the user is a member of the group. Un-comment the Shell line after testing and verifying that the command to be run is correct. Update the messages appropriately, and add your initialization code (break on, etc..).

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#210559 - 2015-08-20 01:48 PM Re: Deploying Software to Computers using Kixtart [Re: Glenn Barnas]
JSosa Offline
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
#210560 - 2015-08-20 04:18 PM Re: Deploying Software to Computers using Kixtart [Re: JSosa]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
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.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#210561 - 2015-08-20 05:06 PM Re: Deploying Software to Computers using Kixtart [Re: Mart]
JSosa Offline
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

 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 \:\(


Edited by Mart (2015-08-20 05:51 PM)
Edit Reason: Added code tags.

Top
#210562 - 2015-08-20 05:57 PM Re: Deploying Software to Computers using Kixtart [Re: JSosa]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
 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
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#210565 - 2015-08-21 02:04 AM Re: Deploying Software to Computers using Kixtart [Re: Mart]
Glenn Barnas Administrator Offline
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:
 Code:
$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.
 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
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! \:D

Top
#210567 - 2015-08-21 05:29 AM Re: Deploying Software to Computers using Kixtart [Re: Glenn Barnas]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
@onwow64 works too Glenn
Top
#210578 - 2015-08-21 08:08 PM Re: Deploying Software to Computers using Kixtart [Re: Allen]
JSosa Offline
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
#210580 - 2015-08-22 01:14 AM Re: Deploying Software to Computers using Kixtart [Re: JSosa]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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.
_________________________
!

download KiXnet

Top
#210581 - 2015-08-22 02:07 AM Re: Deploying Software to Computers using Kixtart [Re: Lonkero]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
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
_________________________
Actually I am a Rocket Scientist! \:D

Top
#210595 - 2015-08-24 01:19 PM Re: Deploying Software to Computers using Kixtart [Re: Glenn Barnas]
JSosa Offline
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 Offline
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
#210597 - 2015-08-24 03:59 PM Re: Deploying Software to Computers using Kixtart [Re: JSosa]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
 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.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#210600 - 2015-08-25 07:11 PM Re: Deploying Software to Computers using Kixtart [Re: Mart]
JSosa Offline
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 Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2125
Loc: Tulsa, OK
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

Top
#210608 - 2015-08-26 02:16 PM Re: Deploying Software to Computers using Kixtart [Re: ShaneEP]
Glenn Barnas Administrator Offline
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
 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
Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#210610 - 2015-08-26 09:15 PM Re: Deploying Software to Computers using Kixtart [Re: Glenn Barnas]
JSosa Offline
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
#211410 - 2016-05-03 10:38 PM Re: Deploying Software to Computers using Kixtart [Re: WayneParker70]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
user post above was deleted.

Edited by NTDOC (2016-05-09 06:33 PM)

Top
Page 1 of 2 12>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 466 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.077 seconds in which 0.026 seconds were spent on a total of 16 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org