Jump to content

icnocop

Member
  • Posts

    63
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    United States

About icnocop

Profile Information

  • OS
    Windows 10 x64

icnocop's Achievements

0

Reputation

  1. Hi. I'm trying to determine the best way to programmatically detect when sysprep has finished executing all SynchronousCommands in FirstLogonCommands from C:\Windows\Panther\unattend.xml. I'd like to do this without having to do something special in unattend.xml, like write to a file as the last command and then if the file exists, then this determines sysprep has finished. I'm wondering if the commands in unattend.xml are written to the registry (like HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce) and then the commands are actually run from the registry? Or does sysprep parse the commands and runs them directly from unattend.xml? What I currently have in mind is as follows: 1. Parse unattend.xml 2. For each SynchronousCommand parse the CommandLine to get the executable 3. Wait until all executables are not running. I'm just wondering if there's a better way because this process is error-prone in at least two ways: 1. There may be a gap in-between the time subsequent SynchronousCommands are run. 2. This process will wait indefinitely if CommandLine contains a process which is the same as one that is run in the background as a service for example. Thank you.
  2. Ok, I found a great post here: http://www.ureader.com/msg/1675551.aspx It mentions using Sleep methods in the following free ActiveX components: ScriptX from Meadroid AutoItX from AutoIt But most importantly, it also links to a hack detailed here: http://forum.script-coding.info/viewtopic.php?pid=29243#p29243 I have actually test the hack and it works great and is my best recommendation so wpi doesn't have to register any com dlls and use another third party utility. )
  3. Another option is to use an ActiveX control, similar to the Java Applet/Flash example here: http://www.devcheater.com/
  4. Maybe this will help: "Two Javascript synchronous sleep functions which won't freeze browser" http://sejq.blogspot.com/2008/12/two-javascript-synchronous-sleep.html The first work-around is for ie and so that may work.
  5. See also, WScript.Sleep http://msdn.microsoft.com/en-us/library/6t81adfd%28VS.85%29.aspx Edit: Sorry, actually the WScript object is not available because hta's are run from mshta.exe and not from wscript.exe (See http://www.eggheadcafe.com/software/aspnet/32306495/hta-and-wscriptsleep.aspx)
  6. Thanks mritter, I would recommend logging the 259 exit code along with "STILL_ACTIVE", but treat it as a "warning". If there is no "warning" status than "successful" seems fine. Thank you.
  7. Can jquery 1.4 be used? http://api.jquery.com/delay/ Or JavaScript's setTimeout? https://developer.mozilla.org/en/DOM/window.setTimeout Or a while loop like this (from http://www.geekpedia.com/KB55_How-do-I-make-a-JavaScript-function-wait-before-executing-(sleep-or-delay).html): function wait(msecs) { var start = new Date().getTime(); var cur = start while(cur - start < msecs) { cur = new Date().getTime(); } } to use: alert(\"Will wait for one second\"); wait(1000); alert(\"Finished waiting\");
  8. I did some more testing\debugging and it seems that wpi will sometimes continue running the next command when it should have waited for the previous reboot request to completely finish. section from config.js: pn++; prog[pn]=['Program Name 1']; shortdesc[pn]=['']; uid[pn]=['ProgramName1']; dflt[pn]=['yes']; forc[pn]=['no']; bit64[pn]=['no']; cat[pn]=['Applications']; rebootcode[pn]=[3010]; repeatcommand[pn]=['yes']; cmds[pn]=['%wpipath%\\install\\ProgramName1.exe params','{reboot}']; desc[pn]=['Program Name 1']; picf[pn]=['%wpipath%\\Graphics\\InstallPackage.png']; picw[pn]=['128']; pich[pn]=['128']; textl[pn]=['Right']; pn++; prog[pn]=['Program Name 2']; shortdesc[pn]=['']; uid[pn]=['ProgramName2']; dflt[pn]=['yes']; forc[pn]=['no']; bit64[pn]=['no']; cat[pn]=['Applications']; rebootcode[pn]=[3010]; repeatcommand[pn]=['yes']; cmds[pn]=['%wpipath%\\install\\ProgramName2.exe params','{reboot}']; desc[pn]=['Program Name 2']; picf[pn]=['%wpipath%\\Graphics\\InstallPackage.png']; picw[pn]=['128']; pich[pn]=['128']; textl[pn]=['Right']; section from wpi_log (after modifying installer.js to output some debug information): ----- Monday, September 20, 2010 3:25:06 PM Program: Program Name 1 Unique ID: ProgramName1 Order: 900006 Category: Applications Monday, September 20, 2010 3:25:06 PM - j starts as 1 Monday, September 20, 2010 3:25:06 PM - commands length 3 Monday, September 20, 2010 3:25:06 PM - command 1 Monday, September 20, 2010 4:05:59 PM - cmd1 Success (returned code 0): d:\WPI\install\ProgramName1.exe params Monday, September 20, 2010 4:06:00 PM - command 2 Monday, September 20, 2010 4:06:04 PM - cmd2 Success (returned code 0): "C:\Windows\System32\shutdown.exe" /r /f /t 0 Monday, September 20, 2010 4:06:10 PM - Finished installation. ----- Monday, September 20, 2010 4:06:10 PM Program: Program Name 2 Unique ID: ProgramName2 Order: 900007 Category: Applications Monday, September 20, 2010 4:06:11 PM - j starts as 1 Monday, September 20, 2010 4:06:11 PM - commands length 3 Monday, September 20, 2010 4:06:11 PM - command 1 Monday, September 20, 2010 4:06:11 PM - cmd1 *** Fail *** (returned code -1073741502): d:\WPI\install\ProgramName2.exe params Monday, September 20, 2010 4:09:16 PM - j starts as 2 Monday, September 20, 2010 4:09:16 PM - commands length 3 Monday, September 20, 2010 4:09:16 PM - command 2 Monday, September 20, 2010 4:09:17 PM - cmd2 Success (returned code 0): "C:\Windows\System32\shutdown.exe" /r /f /t 0 Monday, September 20, 2010 4:10:43 PM - j starts as 3 Monday, September 20, 2010 4:10:43 PM - commands length 3 Monday, September 20, 2010 4:10:43 PM - Finished installation. ----- Notice the date and time stamps between ProgramName1.cmd2 and ProgramName2.cmd1 - wpi did not properly wait for the previous reboot request to finish before moving to the next command. Notice the returned code -1073741502, 0xC0000142, STATUS_DLL_INIT_FAILED, "{DLL Initialization Failed} Initialization of the dynamic link library %hs failed. The process is terminating abnormally.". I am thinking that windows blocked the running of .\wpi\Tools\Sleep.exe because there is a shutdown request, and this caused wpi to continue processing the next command without properly waiting. This would also explain the return code -1073741502 and could also explain the previous wpi log file contents where it skipped cmd1 because windows probably killed mshta.exe before wpi could write to the log file, but after wpi tried to run the command. I am thinking that this issue can be resolved by using a native javascript method to sleep rather than launching an executable for example. Windows 7 x64. What do you think? Thank you.
  9. Hello again, I am noticing that wpi v8.1.0 will sometimes skip the first command from the cmds array. section from config.js: pn++; prog[pn]=['Program Name']; shortdesc[pn]=['']; uid[pn]=['ProgramName']; dflt[pn]=['yes']; forc[pn]=['no']; bit64[pn]=['no']; cat[pn]=['Applications']; rebootcode[pn]=[3010]; repeatcommand[pn]=['yes']; cmds[pn]=['cmd /c %wpipath%\\install\\MyApplication.exe param1 "%wpipath%\\install\\MyLibrary.dll" param2 param3 "param4" "param5"','{reboot}']; desc[pn]=['Program Name']; picf[pn]=['%wpipath%\\Graphics\\InstallPackage.png']; picw[pn]=['128']; pich[pn]=['128']; textl[pn]=['Right']; section from wpi_log: ----- Friday, September 17, 2010 9:28:38 PM Program: Program Name Unique ID: ProgramName Order: 900007 Category: Applications Friday, September 17, 2010 9:31:37 PM - cmd2 Success (returned code 0): "C:\Windows\System32\shutdown.exe" /r /f /t 0 Friday, September 17, 2010 9:33:16 PM - Finished installation. ----- Notice that cmd1 was not run. Any ideas? This is on Windows 7 x64 with UAC turned off. Thank you.
  10. Hi. I am noticing that ExecuteCommandIfFailure does not always run. From useroptions.js (and also indicated in the log file): AbortInstallIfFailure=true; ExecuteCommandIfFailure=['"%wpipath%\\Install\\MyApplication.exe" param1 "%wpipath%\\Install\\MyLibrary.dll" param2 param3 "param4" "" "" "param5" "admin@domain.com" "param 6 param-param-param" "param 7 param-param-param" "param8"']; ContinueWhereFailed=true; From wpi log: ----- Friday, August 27, 2010 1:24:11 AM Program: My Program Name Unique ID: MyProgramName Order: 900042 Category: Applications Friday, August 27, 2010 1:24:13 AM - cmd1 *** Fail *** (returned code 1): cmd /c d:\WPI\install\MyApplication.exe param1 "d:\WPI\install\MyLibrary.dll" param2.param.param param3 "param4" "param5" *** Install aborted because of failure *** ----- Number of failed installations: 1 Install process finished at: Friday, August 27, 2010 1:24:13 AM I am thinking we should include the ExecuteCommandIfFailure command in the log file when it is run so that we can diagnose any issues that may arise. Thank you.
  11. Hi. Congratulations on the v8.1.0 release! I would like to make a request to add an option to ignore certain exit codes. In my scenario, when WPI silently installed Visual Studio 2008 (on Windows 7 x64), the Visual Studio 2008 setup will automatically close mshta.exe (but continue installing) and so WPI will log a return exit code of 259 but indicates it as a failure which is misleading. From MSDN: "... an application should not use STILL_ACTIVE (259) as an error code." Also, just fyi, in my scenario, after visual studio 2008 has finished installing the process I use to install vs2008 will go ahead and relaunch wpi to continue running the remaining commands if it detects that mshta.exe is not already running. Thank you!
  12. Hi. Thank you for the updates. I took the time to test this out and here are my results. 1. stdout redirection and quotes in the path: Pass Ex. command: cmd /c """ping.exe"" ""127.0.0.1"" >c:\test\ping.txt" 2. abort installation process if failure occurs: Pass 3. script or program to execute if failure: Pass 4. Continue next installation where failed: Pass Thank you!
×
×
  • Create New...