Page 1 of 1 1
Topic Options
#194003 - 2009-05-26 03:06 AM Install script not running properly
chipped Offline
Fresh Scripter

Registered: 2008-12-09
Posts: 40
Hey all,

My script that installs programs on startup (as a startup script, so it has admin rights) has been taking a long time to run even after running the first time.

When it runs each program has its own text file that is created after its been installed, before the script installs it checks for a text file (each program has its own unique file) so if its already there it should skip the install.

Even after a few restarts the script takes long to run and all the text files seem to be there, so im thinking my code is wrong?

Anyway , here it is:

 Code:
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

$HANDLE = FreeFileHandle()

;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;Checking to see if Install folder exists, if it dosent then it is created.

IF NOT EXIST("C:\install")
       MD "C:\install"
ENDIF

;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;				INFORMATION											
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;Installing Programs, the name of each program is writen to a folder as a text file.
;If the text file does not exist then the program will be installed, if the file does exist
;then the program will not be installed. 
;
;So if you added a program to this script and then ran it, it woulnt find the text file 
;and then run the setup, the 2nd time it runs the text file will exist since its created 
;the first time round. You can include version numbers in the file name for each program 
;so you can upgrade.

;This method was chosen because its free, easy, FAST and no extra software is required.

;Its recommended that you run this as a startup script from your group policies since 
;startup scripts are run with admin rights which will allow the script to run properly.

;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;Installing Java 6 Update 11

IF $HANDLE > 0
	IF NOT EXIST ("C:\install\Java6u11.txt")
		SHELL "%comspec% /C start /wait \\stingray\share\java6u11.exe /quiet /passive /norestart /s /v ADDLOCAL=ALL IEXPLORER=1 REBOOT=Suppress "
		Close ($HANDLE)
		Open($HANDLE, "C:\install\Java6u11.txt", 1)
	ENDIF
ENDIF

;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;Installing Flash Player 10

IF $HANDLE > 0
	IF NOT EXIST ("C:\install\FlashPlayer10.txt")
		SHELL "%comspec% /C start /wait \\stingray\share\flash10.exe /S "
		Close ($HANDLE)
		Open($HANDLE, "C:\install\FlashPlayer10.txt", 1)
	ENDIF
ENDIF

;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;Installing FileFormatConverter

IF $HANDLE > 0
	IF NOT EXIST ("C:\install\FileFormatConverter.txt")
		SHELL "%comspec% /C start /wait \\stingray\share\FileFormatConverters\O12Conv.msi /quiet /passive /norestart "
		Close ($HANDLE)
		Open($HANDLE, "C:\install\FileFormatConverter.txt", 1)
	ENDIF
ENDIF

;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;Installing GIMP 2.6.2

IF $HANDLE > 0
	IF NOT EXIST ("C:\install\GIMP262.txt")
		SHELL "%comspec% /C start /wait \\stingray\share\gimp.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART "
		Close ($HANDLE)
		Open($HANDLE, "C:\install\GIMP262.txt", 1)
	ENDIF
ENDIF

;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;Installing BullZip PDF Printer

IF $HANDLE > 0
	IF NOT EXIST ("C:\install\BullZipPDFPrinter.txt")
		SHELL "%comspec% /C start /wait \\stingray\share\BullzipPDFPrinter.exe /sp- /silent /norestart /noicons "
		Close ($HANDLE)
		Open($HANDLE, "C:\install\BullZipPDFPrinter.txt", 1)
	ENDIF
ENDIF

;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;Installing Image Resizer Power Toy

IF $HANDLE > 0
	IF NOT EXIST ("C:\install\ImageResizerPowerToy.txt")
		SHELL "%comspec% /C start /wait \\stingray\share\ImageResizerPowertoy.exe /S /v/qn "
		Close ($HANDLE)
		Open($HANDLE, "C:\install\ImageResizerPowerToy.txt", 1)
	ENDIF
ENDIF

;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;Installing AutoItV3

IF $HANDLE > 0
	IF NOT EXIST ("C:\install\AutoItV3.txt")
		SHELL "%comspec% /C start /wait \\stingray\share\AutoItv3.exe /S "
		Close ($HANDLE)
		Open($HANDLE, "C:\install\AutoItV3.txt", 1)
	ENDIF
ENDIF

;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;Installing NotePad++

IF $HANDLE > 0
	IF NOT EXIST ("C:\install\Notepad++v5.1.4.txt")
		SHELL "%comspec% /C start /wait \\stingray\share\Notepad++.exe /S "
		Close ($HANDLE)
		Open($HANDLE, "C:\install\Notepad++v5.1.4.txt", 1)
	ENDIF
ENDIF

;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;Installing Internet Explorer 7

IF $HANDLE > 0
	IF NOT EXIST ("C:\install\IE7.txt")
		SHELL "%comspec% /C start /wait \\stingray\share\IE7.exe /passive /quiet /update-no /norestart "
		Close ($HANDLE)
		Open($HANDLE, "C:\install\IE7.txt", 1)
	ENDIF
ENDIF

;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;Installing PowerShell v1

IF $HANDLE > 0
	IF NOT EXIST ("C:\install\PowerShellv1.0.txt")
		SHELL "%comspec% /C start /wait \\stingray\share\PowerShell.exe /quiet /passive /norestart "
		Close ($HANDLE)
		Open($HANDLE, "C:\install\PowerShellv1.0.txt", 1)
	ENDIF
ENDIF

;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;Installing Codec Pack

IF $HANDLE > 0
	IF NOT EXIST ("C:\install\VCP517.txt")
		SHELL "%comspec% /C start /wait \\stingray\share\VCP517.exe /S /v/qn "
		Close ($HANDLE)
		Open($HANDLE, "C:\install\VCP517.txt", 1)
	ENDIF
ENDIF

;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;Installing Quicktime 7.6

IF $HANDLE > 0
	IF NOT EXIST ("C:\install\Quicktime76.txt")
		SHELL "%comspec% /C start /wait \\stingray\share\quicktime76.exe /quiet /passive /qn /norestart "
		Close ($HANDLE)
		Open($HANDLE, "C:\install\Quicktime76.txt", 1)
	ENDIF
ENDIF

;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;Installing iTunes 8.1

IF $HANDLE > 0
	IF NOT EXIST ("C:\install\iTunes81.txt")
		SHELL "%comspec% /C start /wait \\stingray\share\itunes81.exe /quiet /passive /qn /norestart "
		Close ($HANDLE)
		Open($HANDLE, "C:\install\iTunes81.txt", 1)
	ENDIF
ENDIF

;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;Installing Apple mobile Device Support

IF $HANDLE > 0
	IF NOT EXIST ("C:\install\AppleMobileDeviceSupport.txt")
		SHELL "%comspec% /C start /wait \\stingray\share\itunes81\AppleMobileDeviceSupport.msi /quiet /passive /qn /norestart "
		Close ($HANDLE)
		Open($HANDLE, "C:\install\AppleMobileDeviceSupport.txt", 1)
	ENDIF
ENDIF

;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;Symantec Antivirus configuration file which will configure the CPC server as parent.

;IF $HANDLE > 0
;	IF NOT EXIST ("C:\install\SymantecCPCv13.txt")
;		Open($HANDLE, "C:\install\SymantecCPCv13.txt", 1)
;		DEL "C:\Documents and Settings\All Users\Application Data\Symantec\Symantec AntiVirus Corporate Edition\7.5\GRC.DAT" /c
;		RD "C:\Program Files\Symantec AntiVirus\pki\roots" /s
;		MD "C:\Program Files\Symantec AntiVirus\pki\roots"
;		COPY "\\stingray\share\GRC.DAT" "C:\Documents and Settings\All Users\Application Data\Symantec\Symantec AntiVirus Corporate Edition\7.5\" /c
;		COPY "\\stingray\share\roots\*.*" "C:\Program Files\Symantec AntiVirus\pki\roots\" /c
;		Close ($HANDLE)
;	ENDIF
;ENDIF

;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;Installing Windows XP 2009 daylight savings fix

IF $HANDLE > 0
	IF NOT EXIST ("C:\install\WindowsXP-KB955839-x86-ENUv2.txt")
		SHELL "%comspec% /C start /wait \\stingray\share\WindowsXP-KB955839-x86-ENU.exe /quiet /passive /norestart "
		Close ($HANDLE)
		Open($HANDLE, "C:\install\WindowsXP-KB955839-x86-ENUv2.txt", 1)
	ENDIF
ENDIF

;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;Installing Windows Media Player 11

IF $HANDLE > 0
	IF NOT EXIST ("C:\install\WMP11v2.txt")
		SHELL "%comspec% /C start /wait \\stingray\share\WMP11.exe /Q "
		Close ($HANDLE)
		Open($HANDLE, "C:\install\WMP11v2.txt", 1)
	ENDIF
ENDIF

;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;Installing Student Dropbox shortcut

IF $HANDLE > 0
	IF NOT EXIST ("C:\install\student dropboxv2.txt")
		COPY "\\stingray\share\Student Dropbox.lnk" "C:\Documents and Settings\All Users\Desktop" /c
		Close ($HANDLE)
		Open($HANDLE, "C:\install\student dropboxv2.txt", 1)
	ENDIF
ENDIF

;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;Installing VLC

;IF $HANDLE > 0
;	IF NOT EXIST ("C:\install\VLC098av2.txt")
;		Open($HANDLE, "C:\install\VLC098av2.txt", 1)
;		SHELL "%comspec% /C start /wait \\stingray\share\vlc-0.9.8a.exe /S "
;		Close ($HANDLE)
;	ENDIF
;ENDIF

;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;Installing Student Dropbox shortcut

IF $HANDLE > 0
	IF NOT EXIST ("C:\install\WindowsXP-KB889320-v2-x86-ENU.txt")
		SHELL "%comspec% /C start /wait \\stingray\share\WindowsXP-KB889320-v2-x86-ENU.exe /quiet /passive "
		Close ($HANDLE)
		Open($HANDLE, "C:\install\WindowsXP-KB889320-v2-x86-ENU.txt", 1)
	ENDIF
ENDIF

;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;Installing Symantec Enpoint Protection

IF $HANDLE > 0
	IF NOT EXIST ("C:\Program Files\Symantec\Symantec Endpoint Protection\SymCorpUI.exe")
		SHELL "%comspec% /C start /wait \\stingray\share\frank_32-bit\Setup.exe "
		SHELL "%comspec% /C shutdown -r "
		Close ($HANDLE)
		Open($HANDLE, "C:\install\SymantecEPv2.txt", 1)
	ENDIF
ENDIF

;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


thanks

Top
#194005 - 2009-05-26 04:47 AM Re: Install script not running properly [Re: chipped]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Just a couple of quick points..

Many apps don't like being installed from a UNC path - map a drive letter before you start and reference that drive for your application install point. Will make updating easier too, especially if "stingray" is replaced with "mantaray" ;\)

I'm not sure I like the START WAIT options..

Ditch the reboot, and set a $NEEDREBOOT flag, then "If $REBOOT" - reboot! With your method, only one app can perform a reboot. You can usually install several apps that require reboots and reboot once. (key word, "usually")

Also don't like flag files.. use an INI with sections for each app. Each section (if it exists) would contain an install date. That would allow you to perform updates without having to remove flag files first (or leaving old, outdated flag files behind). For example:
 Code:
; Install "Glenn's Great Garbanzo App"
; get the app's release date
$NewDate = ReadProfileString('Y:\INSTALL.INI', 'GGGA', 'Date')
;If the local date is older than the release data, or the local date is blank, install
$MyDate = ReadProfileString('C:\MyInstalls.ini', 'GGGA', 'Installed')
If Not $MyDate or $MyDate < $NewDate
  ; run the install
  Shell '%COMSPEC% /c Y:\ggga.exe /silent /log c:\install\ggga.log'
  ; update install date if successful
  If Not @ERROR
    WriteProfileString('C:\MyInstalls.ini', 'GGGA', 'Installed', @DATE)
  EndIf
EndIf

Be aware that the error checking above is fundamental - it checks for NO ERRORS, however, some apps return a specific error indicating that the install was successful, but a reboot is required to complete the install. You'll need to identify these situations and handle them accordingly -
 Code:
If Not @ERROR Or @ERROR = 51200
  ; Update install date
  WriteProfileString('C:\MyInstalls.ini', 'GGGA', 'Installed', @DATE)
  If @ERROR = 51200 ; need reboot, set flag
    $NEEDREBOOT = 1
  EndIf
EndIf
Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#194006 - 2009-05-26 06:36 AM Re: Install script not running properly [Re: Glenn Barnas]
chipped Offline
Fresh Scripter

Registered: 2008-12-09
Posts: 40
I test them before they reach the script and UNC paths work fine. I just changed my syntax and I think that fixed it. I was closing the handles before I opened them, thus leaving open file handles and reaching the max of 10.

I think im going to ditch the text files and check the file version directly, if its under xx.xx then update. And leave a install date and errors behind in an .ini like you suggested.

Top
#194008 - 2009-05-26 12:43 PM Re: Install script not running properly [Re: chipped]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
The problems with UNC is that the odd app may not like it, but worse is that most apps register their installation path for future updates or modifications (installing optional components). If it's a UNC path, it can be a bear to change if Stingray is retired and replaced by Mantaray. If you map consistently to a drive letter (Y: in my example) then it doesn't matter what the server is. Also, as your network grows, you can add multiple deployment servers.

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

Top
#194015 - 2009-05-27 02:28 AM Re: Install script not running properly [Re: Glenn Barnas]
chipped Offline
Fresh Scripter

Registered: 2008-12-09
Posts: 40
Yeah thats true, I think I will do it then.

Edited by chipped (2009-05-27 02:29 AM)

Top
#194062 - 2009-05-30 09:26 AM Re: Install script not running properly [Re: chipped]
chipped Offline
Fresh Scripter

Registered: 2008-12-09
Posts: 40
If I didnt use START /WAIT would they all try to run at the same time, or is each one contained until IF ends?
Top
#194063 - 2009-05-30 02:16 PM Re: Install script not running properly [Re: chipped]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
The Kix SHELL command waits for completion, the RUN command spawns the child and continues. Since you're using SHELL, they will be contained.

There is the odd installer (Oracle client comes to mind) that runs in such a way that the installer initializes the system and then spawns a child to do the real work. The installer you first ran exits while the child continues. I don't recall that Start/Wait helps those, but do believe the newer versions have parameters to alter the install so the setup command will wait for the child.

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

Top
#194374 - 2009-06-24 02:10 AM Re: Install script not running properly [Re: Glenn Barnas]
chipped Offline
Fresh Scripter

Registered: 2008-12-09
Posts: 40
How do I map a network drive and then disconnect it?

I have searched everywhere but cannot find this, there is the ingroup way but isnt there simply an option to map and disconnect?

Thanks


Edited by chipped (2009-06-24 02:40 AM)

Top
#194375 - 2009-06-24 02:14 AM Re: Install script not running properly [Re: chipped]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Look at the USE command. It maps and disconnects..

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

Top
#194376 - 2009-06-24 02:39 AM Re: Install script not running properly [Re: Glenn Barnas]
chipped Offline
Fresh Scripter

Registered: 2008-12-09
Posts: 40
Doh! Cant beleive I missed that.

Thanks

Top
#194915 - 2009-07-21 04:21 AM Re: Install script not running properly [Re: chipped]
chipped Offline
Fresh Scripter

Registered: 2008-12-09
Posts: 40
hey again,

I tried using USE to map a drive but I have a weird problem. I map the drive at the start of the script using USE and then disconnect it at the end using USE again.

However, the drive wont map or either connects and disconnects very quickly because the script spits out errors saying it cant find the files. If I take out the USE at the end of the script which disconnects the drive then the drive maps fine and its all good. And vice versa, If I run the USE from a separate script to disconnect it works fine.



Edited by chipped (2009-07-21 04:23 AM)

Top
#194916 - 2009-07-21 08:55 AM Re: Install script not running properly [Re: chipped]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
If the drive maps fine, the app runs fine but disconnecting the drives takes a long time and errors come up about not finding some files it looks like a timing issue.

Is the app really done when the drive is disconnected? If not then the errors make sense.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#194924 - 2009-07-21 11:58 AM Re: Install script not running properly [Re: chipped]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Be sure you're using SHELL and not RUN to launch the setup commands.

Even when you use SHELL, many installers launch a second install process to do the actual work. When you run it interactively, you can't tell, but it screws up automation since the command that the script calls exits in a few seconds after initializing the "real" install process. If this is the case, you'll need to do nothing less than monitor the install process. Basically, launch the pre-installer, loop waiting for the actual install process to start, and then loop waiting for it to end. There are several UDFs to return a list of processes, including WMIProcessList.

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

Top
#194974 - 2009-07-23 05:00 AM Re: Install script not running properly [Re: Glenn Barnas]
chipped Offline
Fresh Scripter

Registered: 2008-12-09
Posts: 40
Doh! I was using USE /DELETE instead of USE /DEL. All good now \:\)

And BTW Glenn, using SHELL dosent wait for the setup to finish, I think because its not actually Kixtart launching the app. Without /wait everything started all at once. So thats back in.

Top
#194975 - 2009-07-23 09:10 AM Re: Install script not running properly [Re: chipped]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1894
Loc: Hilversum, The Netherlands
I have to disagree with Glenn here.
- I do prefer to use UNC paths, but like Glenn pointed out some apps may not like that. So test them before you deploy. I don't like mapping a drive to do so because many installers will then reference back (MSI files most commonly) to the mapped drive that will (by good practise) be removed after installation. The UNC path will always exist. Also like Glenn Pointed out if \\stingray if replaced my \\manataray, so instead use a DFS share, so you can always replace servers without having to rename the servername in the script. Now thats the official way I would put it. The unofficial way I would do is make an Alias for the \\Manataray server in the DNS called Stingray adn everything is fine and dandy :P

- Reboot, I would check if an app needs a reboot, then wait till the end of the script, check the variable if a reboot is neccesary then reboot. In that case all apps ARE installed and the reboot that was neccesary for the app that set the reboot variable did good for other apps that might have needed the reboot too.

Top
#194979 - 2009-07-23 12:34 PM Re: Install script not running properly [Re: Arend_]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
If you simply make an alias in DNS from the new name to the old server name, the share request would be rejected unless you also added a registry hack that permits secondary names in NetBIOS.. Not every organization has/uses DFS, and I've worked in some very large (40+ regional data centers, 60K+ users) that did not employ DFS. We did have five deployment servers, though - one in each region of the country. Each synchronized certain folders with the master server depending on what was to be available to install in that region. This selective replication made DFS impractical.

Granted, the drive letter may not exist at all times, but a drive letter can be mapped to any UNC path before running an update. We generally don't permit dynamic update or "install on first use" crap - either it's there and installed, or someone from IT will install it so it's done in a controlled and defined manner.

I do agree about reboots - I always suppress the reboot and check the exit status to see if a reboot is needed. (That's tricky, as not all result codes are consistent for this.) Then I reboot under control of the install script, never the installed app. This lets the script log the result of the install before the reboot, among other things.

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

Top
#194982 - 2009-07-23 02:10 PM Re: Install script not running properly [Re: Glenn Barnas]
chipped Offline
Fresh Scripter

Registered: 2008-12-09
Posts: 40
Thanks guys, I will keep those in mind. We do have a DFS, so im going to set it up to use that. But hmmmmmm, UNC or mapped drive, I havent had problems with either so far.
Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, 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.07 seconds in which 0.024 seconds were spent on a total of 13 queries. Zlib compression enabled.

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