Posted on 03-24-2018 02:03 PM
This is the default .sh script for ManageEngine Asset Scan. I modified the variables
#!/bin/sh
############ Server details ############
hostName="MSD69"
portNo="443"
protocol="https"
############ Server details ############
SUPPORT="assetexplorer-support@manageengine.com"
PRODUCT="AssetExplorer"
COMPUTERNAME=`hostname`
OUTPUTFILE="$COMPUTERNAME.xml"
main()
{
echo "##### Scanning Started #####"
echo "<?xml version="1.0" encoding="UTF-8" ?><DocRoot>" >$OUTPUTFILE
constructXML "ComputerName" "hostname"
constructXML "OS_Category" "uname -s"
echo "<Hardware_Info>" >>$OUTPUTFILE
constructXML "OS_Category" "sw_vers"
constructXML "Memory_Information" "sysctl hw.physmem"
constructXML "Memory_Information" "sysctl hw.usermem"
constructXML "Memory_Informationw" "sysctl hw.memsize"
constructXML "Memory_Information" "sysctl vm.swapusage"
constructXML "Computer_Information" "hostname"
constructXML "Computer_Information" "hostname -s"
constructXML "CPU_Information" "system_profiler SPHardwareDataType"
constructXML "Disk_Space" "df -k"
constructXML "NIC_Info" "/sbin/ifconfig"
#-----------Last logged in user name -----------
constructXML "Last_logged_user" "finger"
#-------------Chipset, VRAM, Monitor display type, resolution---------------------
constructXML "Monitoranddisplayinfo" "/usr/sbin/system_profiler SPDisplaysDataType"
#--------------Sound card -----------------------------
constructXML "SoundCardinfo" "/usr/sbin/system_profiler SPAudioDataType"
#---------------Memory modules----------------------
constructXML "MemoryInfo" "/usr/sbin/system_profiler SPMemoryDataType"
#--------------Physical drives-------------------------
constructXML "PhysicaldrivesInfo" "/usr/sbin/system_profiler SPParallelATADataType"
#--------------Harddisk info if no data is available in SPParallelATADataType------------
constructXML "HarddrivesInfo" "/usr/sbin/system_profiler SPSerialATADataType"
#----------------Printer Info-----------------------
constructXML "Printer_Info" "/usr/sbin/system_profiler SPPrintersDataType -xml"
echo "</Hardware_Info>" >>$OUTPUTFILE
echo "<Software_Info>" >>$OUTPUTFILE
constructXML "Installed_Softwares" "system_profiler SPApplicationsDataType"
echo "</Software_Info>" >>$OUTPUTFILE
echo "</DocRoot>" >>$OUTPUTFILE
echo "##### Scanning completed #####"
#echo $data
pushData
}
constructXML()
{
##Need to replace the < into < , > into > and & into &#####
echo "<$1><command>$2</command><output><![CDATA[">>$OUTPUTFILE
eval $2 >> $OUTPUTFILE 2>&1
echo "]]></output></$1>" >>$OUTPUTFILE
}
pushData()
{
data=$(cat $OUTPUTFILE)
eval "type curl > /dev/null 2>&1"
if [ $? -ne 0 ]
then
echo "curl is not installed, so could not post the scan data to $PRODUCT, You can import the $COMPUTERNAME.xml available in the current directory into $PRODUCT using Stand Alone Workstations Audit. Executing the curl command will lead to the installation."
exit 1
fi
curl --header "Content-Type: text/xml" --data-binary @$OUTPUTFILE "$protocol://$hostName:$portNo/discoveryServlet/WsDiscoveryServlet?COMPUTERNAME=$COMPUTERNAME"
if [ $? -ne 0 ]
then
echo "$PRODUCT is not reachable. You can import the $COMPUTERNAME.xml available in the current directory into $PRODUCT using Stand Alone Workstations Audit. For further queries, please contact $SUPPORT."
else
rm -rf $OUTPUTFILE
echo "Successfully scanned the system data, Find this machine details in $PRODUCT server."
fi
}
main $*
but it fails to run. Any ideas or could a webhook do this?
Posted on 09-19-2018 02:55 PM
I have a support case on this same script. Haven't made much progress on it though. It doesn't like the CDATA in the script it seems.
Posted on 01-28-2019 04:56 AM
It might be a bit outdated but I've solved this issue by installing outset and dumping the default.sh script in /usr/local/outset/boot-every and login-every folder.
Does the trick for me.
/Joseph
Posted on 03-06-2019 03:29 PM
I just had to deploy this for a customer. In my years I've deployed hundreds of scripts with Jamf, and this is one of the few I've encountered that can't be deployed via Jamf's default Script methods.
The way this vendor architected their script is incompatible with Jamf's default method for running scripts. Specifically, I believe their combined use of $1 and $2 within an echo in the constructXML function is incompatible with Jamf's script running method.
I make it a point to not modify vendor's scripts, so our solution was to simply create a package in Composer that installs the script as-is into the /Library folder. Then Jamf runs the script via an "Execute Command" line added to the default Inventory Update Policy (changed to run once a day). This way both Jamf and Manage Engine are updated at the same time every day.
Posted on 08-11-2023 07:48 AM
Can you elaborate on this more? I am currently trying to get SDP to scan our Macs but not having much luck.