Skip to content

Commit 48399de

Browse files
authored
mdatp check: add mdatp health invocation to check for onboarding (#3492)
* mdatp check: add mdatp health invocation to check for onboarding * omit sudo for command -v
1 parent 51f4128 commit 48399de

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

microsoft/testsuites/mdatp/check-mdatp.sh

+15
Original file line numberDiff line numberDiff line change
@@ -113,5 +113,20 @@ if [ -f "$MDATP_OPT_DIR/mdatp_onboard.json" ]; then
113113
EXIT_CODE=$EXIT_ONBOARD_INFO_FOUND
114114
fi
115115

116+
# special log line if mdatp installed and reports it is onboarded
117+
MDATP_ORG_ID=$(\
118+
command -v mdatp \
119+
&& mdatp health \
120+
| grep --fixed-strings 'org_id:' \
121+
| cut -f 2 -d ':' \
122+
| tr -d '[:blank:][:punct:]' \
123+
)
124+
if [ -n "$MDATP_ORG_ID" ]; then
125+
echo "$ERROR_MSG_HEADER" >&2
126+
echo "ERROR: mdatp is installed and reports this device is onboarded:" >&2
127+
sudo mdatp health >&2
128+
EXIT_CODE=$EXIT_ONBOARD_INFO_FOUND
129+
fi
130+
116131
# returns nonzero value if defender info is found
117132
exit $EXIT_CODE

0 commit comments

Comments
 (0)