Video Screencast Help

Return Code -2147467259 on Software Mgmt Job

Created: 02 Oct 2013 • Updated: 22 Oct 2013 | 10 comments
This issue has been solved. See solution.

I created a batch file to import a registry setting into HKCU and set the software management policy to "Repeat this task for each logged on user".  It runs just fine if manually executed but for some strange reason when the scheduled job fires off, it fails where I get return code -2147467259 in the Symantec Management Agent's task history.  However, if I click the Application Task in the SMA to run it, it completes successfully.  This is the first s/w delivery job in SMP 7.1 SP2 MP1.1 I had to set up with a run once per user option.  Has anyone else seen this type of behavior before?

Operating Systems:

Comments 10 CommentsJump to latest comment

andykn101's picture

As well as running it at user logon I think you have to run it as the logged in user.

Your error code is a bit of a cryptic one:

Run-time error '-2147467259 (80004005)':
Method 'SetFocus' of object 'CommandBarPopup' failed

http://support.microsoft.com/kb/286126

 

Authorised Symantec Consultant (ASC) with Endpoint Management Limited, an Authorised Symantec Delivery Provider based in the UK.

Connect Etiquette: Please "Mark as Solution" posts that fix your problem.

Clint's picture

I'm already running the batch file as the currently logged in user as this was necessary to change something in HKCU.  Anyway, I have since found the following article which got me a bit farther after changing the run from "Hidden" to "Minimized".

http://www.symantec.com/docs/TECH209838

Now the scheduled policy fires off without that odd runtime error at the get-go where the SMA shows "Success" for the batch file execution.  However, Task History indicates a -1 return code with no change performed in the registry.  I believe that something's quirky with the "timeout" command (available on a Win7 box) to pause the batch file for 5 seconds and the way Altiris runs the batch file minimized.

In my batch file I'm copying in a .reg file to the workstation then doing a "reg import", executing timeout then deleting the reg file to clean things up.  However, I'm thinking maybe the pause isn't working and the delete is occurring before the reg import gets a chance to do its job.  The batch file runs just fine manually but it could be one of those odd situations as mentioned in the tech article.  I have yet to test another way to handle the pause and will do so next week.

Clint

Clint's picture

Based upon TECH209838 and my testing, I seriously think there's a bug in how Software Management Solution executes policies where you want to run the job only when a user is logged on, need to do so under their credentials, and to run once per user (and maybe only with batch files?...who knows).  When the scheduled policy fires off, my first detection check says "Failure" instead of "Not Detected" or "Detected" with a return code of -1.  Manually running the job via the SMA works as expected.

After looking at TECH209838 again, the only other option I didn't try was opposite to what the article mentioned (i.e. "It may also be necessary to enable the setting Allow user to interact with installing software.") as a possible resolution.  I tried unchecking this box and rescheduled my job after which it completed successfully!  Exit code was 1 this time around instead of -1 but I never paid attention to return codes from batch files.  Main thing was that my registry got updated for HKCU.

For this latest run, I manually did Settings->Update in the SMA to force a configuration update after which my jobs fired off.  However, want to be absolutely sure my policies will fire off without human intervention so I deleted the registry key (I imported via the previous job run) on a couple of my test VMs I've been playing around with and rescheduled the policy for tomorrow.  Will keep you guys posted.

Clint

andykn101's picture

You maybe coulf try without the batch file. If you put the reg key in the Package then just have this command line:

CMD/ C "regedit.exe /S yourregfile.reg"

Authorised Symantec Consultant (ASC) with Endpoint Management Limited, an Authorised Symantec Delivery Provider based in the UK.

Connect Etiquette: Please "Mark as Solution" posts that fix your problem.

HighTower's picture

Did you try a .cmd file instead of a .bat file?  I ran into a weird issue a couple of years ago and simply changing the file type fixed it.  I wish I could remember what it was...

SOLUTION
Clint's picture

Unfortunately my previously scheduled job again had a "Failure" status (return code -1) during the detection phase on both of my test VMs this morning.  I'm giving changing the extension from bat to cmd a shot.  Now with the cmd change, I scheduled my policy to fire off a few minutes ahead, did an Update in the SMA Settings where it successfully completed.

However, I've seen this behavior before where my forcing the SMA to "prematurely" update its settings has the job completing successfully.  What I'm trying now is I created a new schedule, left the default 00:00 time but changed Advanced settings for tomorrow's date so the jobs should kick off as soon as I log into each of my test Win7 VMs tomorrow.

Think I previously mentioned that this is the first s/w management (7.1) job where I had to run once per user under their credentials.  I've pushed out other .bat files under System Account with no problems so I believe this is a bug with a certain combination of Run options.  Maybe SMP 7.5 fixes these issues?  ;-)

Clint

andykn101's picture

Try it on a "proper" PC. I've had HKCU Detection Rules fail quite often on my VMWare Worksation VMs but they seem to work in live on real PCs.

Edit: I always put it down to the fact that my VM builds aren't proper production ones, we don't have a VM build as such and/or it's using NAT.

Authorised Symantec Consultant (ASC) with Endpoint Management Limited, an Authorised Symantec Delivery Provider based in the UK.

Connect Etiquette: Please "Mark as Solution" posts that fix your problem.

Clint's picture

Taking your suggestion and testing on physical boxes as well.  Trying to find some "guinea pigs" at the moment.  Hopefully results will be similar since we're considering using VDI in certain situations.

As for VMware Workstation, I usually set mine to Bridged to more closely emulate an actual production PC.

Clint

andykn101's picture

I'm not allowed, strictly only one MAC per switch port - temporary exceptions for PXE booting to build only.

Authorised Symantec Consultant (ASC) with Endpoint Management Limited, an Authorised Symantec Delivery Provider based in the UK.

Connect Etiquette: Please "Mark as Solution" posts that fix your problem.

HighTower's picture

http://stackoverflow.com/questions/148968/windows-batch-files-bat-vs-cmd

 

New Quote from Wikipedia

The only known difference between .cmd and .bat file execution is that in a .cmd file the ERRORLEVEL variable changes even on a successful command that is affected by Command Extensions (when Command Extensions are enabled), whereas in .bat files the ERRORLEVEL variable changes only upon errors.

The source for the Wikipedia quote above is actually based on this news group posting.

The differences between .CMD and .BAT as far as CMD.EXE is concerned are: With extensions enabled, PATH/APPEND/PROMPT/SET/ASSOC in .CMD files will set ERRORLEVEL regardless of error. .BAT sets ERRORLEVEL only on errors.