Hi,
I have successfully created a custom action that executes a script to delete the .job file from the WindowsFolder\Tasks directory:
Code: Select all
var WindowsFolder = 0;
var FSO = new ActiveXObject("Scripting.FileSystemObject");
var CustomActionData = Session.Property("CustomActionData");
function deleteJob() {
var jobfile, result;
jobfile = FSO.BuildPath(FSO.BuildPath(FSO.GetSpecialFolder(WindowsFolder), "Tasks"), CustomActionData);
result = 0;
try {
if (FSO.FileExists(jobfile))
FSO.DeleteFile(jobfile);
}
catch(err) {
result = err.number;
}
return result;
}
I placed this script in InstallExecuteSequence->Install and it runs deferred with no impersonation. The action data field is filled in with the job file's name, and the CA's condition is ((&ScheduledTask=2) And (!ScheduledTask=3)) meaning the CA will run when the
ScheduledTask feature is being uninstalled. The script works, and deletes the task when the feature is removed.
However, if I run the installer again and reselect the feature, the scheduled task is not recreated. The condition for the scheduled task is: &ScheduledTask=3 -- which I thought is supposed to mean "create the task if the
ScheduledTask is set to be installed."
It appears that the scheduled task condition only works during the first install, but not for a modify or repair. Any advice or assistance is appreciated.
Thanks,
Bill
FOLLOW US
Get the latest news in Application Packaging