K1000 scripting - How to make task 2 wait for task 1 to finish
Hi there,
I am trying to create a script that installs 2 pieces of software. One is the Microsoft Visual c++ 2005 Redistributable and the other is IBM System I Access for Windows V6R1M0.
At the moment I have them set up in 2 tasks, but it seems that The IBM System I task is kicking off before the C++ Redistributable has finished, thus failing.
I have attached a screenshot of the script.
If the c++ redistributable is not installed, the script will install it, but the IBM System I installation will fail. But if the c++ redistributable is already installed, it will skip task 1 and perform task 2 and install IBM System I.
So how can I make Task 2 wait for Task 1 to complete? As you can see, the Task 2 is referencing an MI, so I do not want to edit the install.bat that I have already created with a pause at the start, unless it is absolutely necessary.
EDIT - Just wanted to let people know that I am fairly new to scripting, so please let me know if I am doing it completely wrong :)
Cheers,
Brendan
Answers (5)
Hi All, Thank you all for your help. I ended up adding the installation of the Visual C++ redistributable as the first step in the IBM Install.bat file. :: :: Microsoft Visual C++ 2005 Redistributable Installation msiexec.exe /i 2005vcredist_x86\vcredist.msi /q :: :: IBM System i Access for Windows V6R1M0 Installation start /wait AS400\cwbinstall.msi /qn REBOOT=ReallySuppress :: XCOPY "SSLKey" "C:\Program FIles\IBM\SSLKey" /I /Y /E :: regedit.exe /s as400keydatabaseXP.reg :: XCOPY "Session" "C:\Program Files\IBM\Client Access\Emulator\Private" /I /Y /E :: copy "AS400 Display Session.lnk" "C:\Documents and Settings\All Users\Desktop\" :: del "C:\Documents and Settings\All Users\Desktop\IBM System i Access for Windows.lnk" del "C:\Documents and Settings\All Users\Desktop\System i Navigator.lnk"
Hi All,
Thank you all for your help. I ended up adding the installation of the Visual C++ redistributable as the first step in the IBM Install.bat file.
::
:: Microsoft Visual C++ 2005 Redistributable Installation
msiexec.exe /i 2005vcredist_x86\vcredist.msi /q
::
:: IBM System i Access for Windows V6R1M0 Installation
start /wait AS400\cwbinstall.msi /qn REBOOT=ReallySuppress
::
XCOPY "SSLKey" "C:\Program FIles\IBM\SSLKey" /I /Y /E
::
regedit.exe /s as400keydatabaseXP.reg
::
XCOPY "Session" "C:\Program Files\IBM\Client Access\Emulator\Private" /I /Y /E
::
copy "AS400 Display Session.lnk" "C:\Documents and Settings\All Users\Desktop\"
::
del "C:\Documents and Settings\All Users\Desktop\IBM System i Access for Windows.lnk"
del "C:\Documents and Settings\All Users\Desktop\System i Navigator.lnk"
Thanks again guys, what a wonderful community!
Comments:
-
Cool glad that occurred to you, I mentioned that was your problem in the one reply but never thought to tell you to try thats - SMal.tmcc 11 years ago
Since you are using a batch file you can put start \wait in front of the command to sequence them
for example
start /wait Wmic computersystem where name="%computername%" call unjoindomainorworkgroup
start /wait cscript.exe -b c:\windows\w2d\join_domain.vbs
Comments:
-
Hi there, thank you for your response.
I have altered the batch file that I have running in Task 2 (found in the managed installation), but it is still not waiting. When I run the Install.bat on my machine, or if the software in Task 1 is already installed, it works fine.
Here are the contents of that batch file:
start /wait AS400\cwbinstall.msi /qn REBOOT=ReallySuppress
::
XCOPY "SSLKey" "C:\Program FIles\IBM\SSLKey" /I /Y /E
::
regedit.exe /s as400keydatabaseXP.reg
::
XCOPY "Session" "C:\Program Files\IBM\Client Access\Emulator\Private" /I /Y /E
::
copy "AS400 Display Session.lnk" "C:\Documents and Settings\All Users\Desktop\"
::
del "C:\Documents and Settings\All Users\Desktop\IBM System i Access for Windows.lnk"
del "C:\Documents and Settings\All Users\Desktop\System i Navigator.lnk"
Am I missing something? - bhallida 11 years ago-
I miss read the lines. that will only work if both calls are in the same batch file, let me reread. - SMal.tmcc 11 years ago
-
you can always add a line like
ping 127.0.0.1 -n 2 -w 1000 > NUL
to your batch to cause a sudo sleep before starting the install
or get download and add sleep.exe to your dependencies and put that in the batch prior to the install
http://www.microsoft.com/en-us/download/details.aspx?id=17657 - SMal.tmcc 11 years ago -
windows 7 also has a program called timeout. open cmd window and type timeout /? for details - SMal.tmcc 11 years ago
-
Can you split this into two different scripts and run one 5 minutes after the first ones schedule? - SMal.tmcc 11 years ago
-
Not really, as the batch file is part of a managed install. I will try the ping timeout this morning and see how that fairs. - bhallida 11 years ago
-
got that info from
http://superuser.com/questions/48231/how-do-i-make-a-batch-file-wait-sleep-for-some-seconds - SMal.tmcc 11 years ago
You could also Separate this out into 2 Managed Installs where the first install has a lower deploy order than the second install.
Comments:
-
I tried this after you suggested, but it did not work. I left the first one at 10 and changed the IBM managed install as 11 and 20 and it still did not kick off. Anyone know where the logs are stored for this? I have the logs that I created in the script, but are there any other ones? - bhallida 11 years ago
In task 1 when you launch the batch file during the remediation step, is the check box to wait for completion checked?
Comments:
-
Hi Chuck,
Yes it is. I have another script that is similar to this, and that check box is what fixed that one. But this one does not work. :S - bhallida 11 years ago