#194003 - 2009-05-26 03:06 AM
Install script not running properly
|
chipped
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:
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$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
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: ; 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 - 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!
|
Top
|
|
|
|
#194006 - 2009-05-26 06:36 AM
Re: Install script not running properly
[Re: Glenn Barnas]
|
chipped
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
|
|
|
|
#194015 - 2009-05-27 02:28 AM
Re: Install script not running properly
[Re: Glenn Barnas]
|
chipped
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
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
|
|
|
|
#194374 - 2009-06-24 02:10 AM
Re: Install script not running properly
[Re: Glenn Barnas]
|
chipped
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
|
|
|
|
#194376 - 2009-06-24 02:39 AM
Re: Install script not running properly
[Re: Glenn Barnas]
|
chipped
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
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
|
|
|
|
#194974 - 2009-07-23 05:00 AM
Re: Install script not running properly
[Re: Glenn Barnas]
|
chipped
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
|
|
|
|
#194979 - 2009-07-23 12:34 PM
Re: Install script not running properly
[Re: Arend_]
|
Glenn Barnas
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!
|
Top
|
|
|
|
#194982 - 2009-07-23 02:10 PM
Re: Install script not running properly
[Re: Glenn Barnas]
|
chipped
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
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 331 anonymous users online.
|
|
|