Category Archives: K2000

Distributing Applications as a Post Installation Task

Distributing applications as a post installation task has always been a challenge with Symantec Ghost.  A person has to walk to each PC and log in, then install a few things by hand.  Part of the KACE proof of concept was to remove the human interaction and do everything with the KACE tools.  I had a hard time getting this to work until I found the K2000 postinstall task converter.  The K2000 injects the post installation tasks into the syspreped image file.  It adds a batch file to the C:\Windows\setup directory that is called by Windows setup on first boot.  That batch file in turn calls the C:\KACE\InstallCmds.bat file to launch the post application installs.

That is all great unless the machine restarts.  Then there is nothing to get the process restarted.  My PC name task which has to be first, causes the PC to reboot a few times.  This task would run but nothing else.  I needed the Total Defense Antivirus, K1000 Agent, and for now the Novell Zenworks Configuration Manager Agent to install – After the PC has been named.

The post install task converter takes the InstallCmds.bat file and turns it into a series of Run Once registry commands.  This allows the PC to reboot and then continue with the post install tasks.  It does have a requirement that made me modify the PC Name and Join Domain task.  It needs a reboot task and not the shutdown commands in my existing batch files.

Using the Run Once Converter for Distributing Applications as a Post Installation Task

Use the link above to fetch the Run Once Converter and install it to your K2000 following their instructions.  Once it is installed you edit your System Image Details and add the Run Once Converter as a Mid Level Task.

SystemI mage Details Run Once Converter

Then you have to create a reboot post installation task and add it between any Post Installation Tasks that require a reboot.

System Image Details Reboot Task

The Reboot task is simple enough  It contains

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

The task kills any run once executable that is still in memory and then issues a shutdown.  The ping just gives the machine something to do while waiting for the reboot to occur.  The idea is to prevent the task (batch file) from finishing before the reboot.

I added the ksleep.exe as a timeout to allow the PC to restart and complete the OS boot process before continuing.  I use them to wait for an installer to finish before moving on to the next task.  you can get ksleep.exe by using the recovery tools on the boot menu and copying the exe to a USB drive or network share.

I reworked my NameJoinDomain task.  I split out the name part and modified the start_x64.bat to look like this:

REM Rename Windows 7 x64

xcopy /S /E /I ws-name c:\ws-name

c:\ws-name\wsname.exe /RDF:c:\ws-name\namedb.dat /DFK:$SERIALNUM /Logfile:C:\wsname.log

REM - MAC Address
REM c:\ws-name\wsname.exe /RDF:c:\ws-name\namedb.dat /DFK:$MAC /EXCLUDEADAPTERS[WIRELESS WIFI WLAN BLUETOOTH PPP VMWARE IPSEC CENTRINO] /Logfile:C:\wsname.log

REM - $Asset
REM c:\ws-name\wsname.exe /RDF:c:\ws-name\namedb.dat /DFK:$ASSETTAG /Logfile:C:\wsname.log

This is now the V1 Name by Asset task, which is really using the serial number to look up the name.  The V2 Join the DPA Domain task has its own start_x64.bat file and it looks like this:

REM Join a Windows 7 x64 computer to a domain

xcopy /S /E /I joindom c:\joindom

REM ***** Join_Domain.vbs <domain> <DomainUser> <password> <Default domain DNS Server IP> *****>
C:\joindom\Join_Domain.vbs DPA DomainAdministrator password > C:\JoinDomain.log

That took care of all the problems I was having getting the Post Installation Tasks to work.