In some instances, when inventorying Mac agents running the 5.3 agent, a MacUtil.class error message will occur similar to this:

 

This error occurs because the agent was unable to gather all of the necessary data from SystemProfiler.  First, update the Mac agent to the latest 5.3 agent. Then follow these instructions to resolve this error.

  1. Create a manual inventory.xml file by running /Library/Application\ Support/Dell/KACE/bin/MacInventoryU > inventory.xml .
  2. View the new inventory.xml file.  If it shows a complete inventory of the system without containing any errors, then it will automatically update to the KBOX and the inventory issue will go away.

If an error message similar to this is in the inventory.xml file instead:

ash-3.2# /Library/Application\ Support/Dell/KACE/bin/MacInventoryU > inventory.xml 
2012-03-05 15:02:02.224 MacInventoryU[4599:903] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFString appendString:]: nil argument' 
*** Call stack at first throw: 

0 CoreFoundation 0x99a556ca __raiseError + 410 
1 libobjc.A.dylib 0x908245a9 objc_exception_throw + 56 
2 CoreFoundation 0x99a553f8 +[NSException raise:format:arguments:] + 136 
3 CoreFoundation 0x99a5536a +[NSException raise:format:] + 58 
4 Foundation 0x943b5dc6 mutateError + 156 
5 MacInventoryU 0x00002eb7 -[SystemProfiler runProfileForDataTypes:detailLevel:] + 1423 
6 MacInventoryU 0x000027b9 -[SystemProfiler runProfileForDataTypes:] + 301 
7 MacInventoryU 0x00002017 main + 1017 
8 MacInventoryU 0x00001c02 _start + 216 
9 MacInventoryU 0x00001b29 start + 41 
10 ??? 0x00000001 0x0 + 1 

Trace/BPT trap 


The problem is related to either Spotlight being disabled on the Mac system or its Metadata is corrupt. SystemProfiler depends on Spotlight to populate its data. To resolve this conflict, the metadata file on the Mac agent will need to be rebuilt. To do this, Open Terminal (/Applications/Utilities/Terminal.app) and run sudo mdutil -i on -E /

This will rebuild the metadata file on the Mac system and it will inventory successfully in the KBOX. In some cases, this rebuild will resolve the problem permanently. However, a customer's environment may contain a few Macs that will need this process conducted on a regular basis.  To eliminate time and the need to add this workaround to the increasing daily requirements our IT customers are currently responsible for in each of their work environments, a script has been developed to impliment this task for you.

Below is the XML version of the script you can run from your KBOX:


<?xml version="1.0" encoding="utf-8" ?>
<kbots xmlns="http://kace.com/Kbots.xsd">
<kbot>
<config name="Clear MacOS Spotlight Metadata" type="policy" id="69" version="1331252818" description="This script can be used to help resolve issues dealing with problems uploading MacOS inventory to the appliance. Some of the symptoms can include incomplete inventory upload to the appliance, or getting the &quot;MacUtil.class&quot; error in the comments section of a MacOS inventory detail page.">
<execute disconnected="false" logged_off="false">
</execute>
</config>
<compliance>
<verify on_failure="break" attempts="1">
<file_exists path="/Library/Application Support/Dell/KACE/data/" file="spotlight.com" />
<on_verify_success>
<log_message type="status" message="Clear Spotlight Metadata script has already been run on this machine" />
</on_verify_success>
<on_verify_failure>
<launch_program path="/usr/bin" program="mdutil" wait="true" parms="-i off" />
<launch_program path="/usr/bin" program="mdutil" wait="true" parms="-i on -E /" />
<launch_program path="/usr/bin" program="touch" wait="true" parms="/Library/Application\ Support/Dell/KACE/data/spotlight.com" />
<on_remediation_success>
<log_message type="status" message="Clear Spotlight Metadata script successfully completed" />
</on_remediation_success>
<on_remediation_failure>
<log_message type="status" message="Clear Spotlight Metadata script failed to run" />
</on_remediation_failure>
</on_verify_failure>
</verify>
</compliance>
</kbot>
</kbots>

It will default to an Offline Kscript.

This script will create a file called "spotlight.com" in the agent log directory (/Library/Application Support/Dell/KACE/data).  If it detects that this file exists, it will not run again.

NOTE:  This workaround will not remove the MacUtil.class error message displayed on an Inventoried Mac agent summary page.  The MacUtil.class error message will be resolved in the 5.4 release. The responsibility of this workaround is to allow you to inventory your Mac units if you are faced with this problem.

If you discover that the above script only inventories your Mac units for a only a day or two and you find yourself back to the original problem, you can run the below script which will run the metadata clean even if spotlight.com is detected. This script will also update the timestamp on the last modified date on the "spotlight.com" file when it touches it again.

 

Note: IF you have upgraded to 5.4 from 5.3 and had this problem originally, the issue is fixed and the scripts are no longer needed.  However, the MacUtil error note will remain on the system in inventory.  To remove, open notes, delete the message and save.