KACE Product Support Question

K2000 postinstall task converter

02/13/2012 12384 views

This is a script created by Patrick Warme and Corey Serrins of the support team. 

This script was created to convert your post-installation tasks to run via RunOnceEx commands for Windows 7. Our goal is to allow post-installation tasks to survive reboots and help with installers that do not 'wait' properly and interrupt other installations.

The script runs on both Windows 7 Scripted Installs as well as Windows 7 sysprepped image deployments (non-sysprepped images will not work at this time).

You can download it here:

NOTE: This script is for 3.4 and 3.5 only, it does not work for 3.6, which has a new Task Engine.

After downloading the file, you will find a README documenting the task, a export of reboot postinstall task that is known to work with this process, as well as a .zip file to upload to the k2 to implement this task.

Here's what you'll need to do:

  1. Set up your Scripted Install or Sysprepped Image with your desired Postinstall Tasks
  2. Create a new Application post install task with a runtime environment set to "K2000 Boot Environment (Windows)"
  3. Attach the zipped file called "runonceex_converter_task.zip"
  4. Use "call runonceex_converter.bat" as the command line.
  5. If one of your postinstall tasks already calls for a reboot, you can use that, import the one provided, or create your own reboot task, but make sure the word "reboot" is in the name. If you create your own, we do recommend the following be in the .bat command since we found this to work best:
    taskkill /f /IM runonce.exe
    shutdown -f -r -t 1
    ping -n 30
  6. Duplicate your reboot commands as many times as you like
  7. Add the PO Converter mid-level task to your deployment. 
  8. Add the reboots where you like as a post install task and save.

This should resolve any issues you experienced with reboots in your post install tasks with the K2000 and Windows 7.

Any feedback or comments would be welcome! Please log them on the blog post:



Script was updated to v. 1.5.2 (5/10/2012)
-Scripted installs were not reporting as completed, fixed that in this release. 

Answer Summary:
1 Comment   [ + ] Show comment


  • Hi,

    Just like to say, great script. It has been working well for me until I started trying to image a Toshiba Z830 and Z930 laptops with SSD's. What seems to happen is towards the end of my image, after I have installed the Toshiba Drivers that need to be installed post install, when the reboot command runs it doesn't shut down the runonce.exe correctly. This consequence of this is the next thing in the runonce list try's to run and generally fails with a error msg "cmd.exe failed error 0xc0000142". I have tried to prevent this but have been unable. It only seems to happen to the Toshiba's, I don't have the issue on Lenovo's, HP Desktops or VM desktops. In each case I am installing a near identical version of windows enterprise x64 in a scripted install. Any help would be appreciated.

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

All Answers

Sorry for not responding sooner, but I will be testing this and leaving feedback when I get the chance. I think many customers will appreciate this tool. Thanks for the hard work!
Answered 02/16/2012 by: mpace
Red Belt

Patrick & Corey,

I just wanted to give you some feedback so that others know this is a *very* useful tool for Win7 scripted installs and to thank you both very much for sharing this.

Someone in one of the other threads mentioned how the postinstalls are handled differently in WinXP compared to Win7, and I can definitely confirm this is a (if not *the*) factor - the postinstalls that were working so welll (and consistently) in my WinXP scripted installs were flaky until I used your converter.

For details - I was running into the same inconsistencies with postinstalls in Win7 x64 scripted installs that others have mentioned. Still running a version of 3.3 on my K21000. Postinstalls are a mix of silent installs (both EXE & MSI), AutoIT compiled scripts and batch files to do a variety of things (including reboots in between some tasks). Outside of "start /wait" and "call", I really didn't want to have to fall back on other methods (extended pings to avoid tasks jumping ahead of each other, creating a post-install "app bundle" and having to maintain these bundles, etc) and your converter is doing the trick. I've pushed 6 different Win7 x64 scripted installs so far (still testing) and it has helped both with apps that were consistently failing to install (despite installing fine outside of the postinstalls) and other odd inconsistencies (apps installing or not randomly). It feels more like my WinXP scripted installs now (which is a good thing).

As I mentioned, I haven't made the jump to 3.4 yet, but just curious if this is included or not. If not, any plans to make it a standard component? It should be.

Thanks again and keep up the great work!

Answered 03/08/2012 by: jverbosk
Red Belt

  • Glad to hear it's working for you, John. This isn't included in 3.4, it's something we wrote in our spare time after 3.4 was released.
How do i get a username/password for the kace.com site? We already have the paperwork in process for the K2000. Is this something that i get from our Dell sales rep?
Answered 03/11/2012 by: dj
Orange Belt

You can call Kace support, that's what I did.

Answered 03/11/2012 by: jverbosk
Red Belt

Another way of doing it is to create a bat script post task that does the following:

taskkill /f /IM runonce.exe
shutdown -f -r -t 1
ping -n 30

It took me some time, but I found out that if I kill the "runonce.exe" task before I force a shutdown then it will not start the next task.
The ping afterwards might not be needed, but I just have it to let the cmd prompt stay up
Answered 03/12/2012 by: rmeyer
Second Degree Blue Belt

This content is currently hidden from public view.
Reason: Hidden by Admin For more information, visit our FAQ's.
It does pick up again yes

works like a charm for me :)
Answered 03/13/2012 by: rmeyer
Second Degree Blue Belt

pull the tablecloth off the table full of a china place settings.

is this is Ghostbuster reference?
Answered 03/14/2012 by: dchristian
Red Belt

  • Not that I'm aware ;)
    • And the flowers are still standing!
FYI: Big update coming!!!
Answered 03/21/2012 by: cserrins
Red Belt

Please check out KB Article 1151 on KACE support site, we'll update main post when Patrick returns from his cozy vacation ;)
Answered 03/21/2012 by: cserrins
Red Belt

Thank you for all your kind words!

As Corey said, we had a big update and the script now works on sysprepped Windows 7 image deployments in addition to Windows 7 Scripted Installs. Please let us know how it works for you!
Answered 03/26/2012 by: warmep
Third Degree Green Belt


Is it possible to re-upload the script again, because the link doesn't work anymore.

Answered 03/30/2012 by: UnderYens
Orange Senior Belt

  • UnderYens, thank you for pointing that out, the link has been updated:

Hello, I added this to our Scripted Windows 7 deployment, however at the end of our post installs tasks we have a standard reboot, I noticed in the runonce this is followed by some other tasks (must be created by this tool?) and it reboots before these can occure which I'm guessing is not ideal.

Can you update it to provide a reboot switch so it creates a final task to reboot the system (out of the admin account and ready for a standard user to log in to)?

Secondly... can you add support for Windows XP? I've tried and it says "it doesn't support Windows 7 un-sysprepped images at this time." Granted, we're trying to move onto 7, but still need to have the option.

The actual reason for using this was to survive reboots, so the first thing it would do is rename the PC, reboot, then join the domain, reboot, then install software and settings, then finally reboot ready for the user.

Images are easy as we use a sysprep and inject the computer name into the unattend or syspref file... unfortunately there's no option for that with scripted installs, so trying to use this method and amend the script for collecting the computer name (the vbs that puts it in a mac address file on T:\), then later reads and saves this to the C:\ drive to be used by the renaming rule.

I prefer the vbs files as I can edit them to my liking, can't do that with your .exe's, although from the last download I looked in, I think I know what you used to write them, so perhaps I could reverse-engineer them.

Answered 07/13/2012 by: AJStevens
Senior Purple Belt

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login


This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ