nilesh1988 wrote:
Its not a problem with a code or my MDM tool.
Obviously, it is.
Because even if i run the command directly in terminal "sudo fdesetup status" I get below results in some of our macs.
Off\nappear - ?
On\nkeychai - ?
So i am just trying to understand what is the meaning of that result.
There is no meaning. Your script is invalid. Full stop.
You cannot assume that any system tool is going to give valid and predictable results in 100% of cases, on 100% of computers. That has never happened. You cannot parse the output from such tools with something like "| awk {'print$3'} | rev | cut -c 2- | rev". It's simply wrong.
Even if the tool provided true, machine readable output like XML, that still does not abrogate your responsibility to handle error cases, or handle result codes, or standard output vs. standard error, or gracefully handle unexpected output.
You can easily run "strings" on fdesetup to see what that "appear" and "keychai" phrases probably mean. Of course, that doesn't mean that situation is actually true. This could simply be a bug in fdesetup that is only being triggered in rare cases. Or maybe you are doing something else funky. Or maybe there is some strange system interaction happening that is specific to these machines. You don't even need to run "sudo" at all to get the status. That alone introduces a whole different level of complexity.