#!/bin/bash

appInfoPlistName="/Library/ManageEngine/UEMS_Agent/data/dcconfig_data.plist"

machineInfoPlistName="/Library/ManageEngine/UEMS_Agent/data/dcmachine_data.plist"

/usr/libexec/PlistBuddy -c "Delete :HardwareUUID" $machineInfoPlistName 2>/dev/null

/usr/libexec/PlistBuddy -c "Delete :SerialNumber" $machineInfoPlistName 2>/dev/null

/usr/libexec/PlistBuddy -c "Delete :ImageDetectTime" $appInfoPlistName 2>/dev/null

/usr/libexec/PlistBuddy -c "Delete :ImagedComputer" $appInfoPlistName 2>/dev/null

/usr/libexec/PlistBuddy -c "Add :ImagedComputer string No" $appInfoPlistName 2>/dev/null

exitCode=$?

if [ "$exitCode" = "0" ]; then
    echo "Successfully Executed"
    /Library/ManageEngine/UEMS_Agent/bin/cfgupdate
else
      echo "Failed to set ImagedComputer as No, Please contact Endpoint central support"
fi

exit $exitCode