I’m currently developing a remediation policy for Self Service that triggers the uninstall and reinstall of a profile. While I can successfully remove and reinstall the profile, I need a verification step to check if the profile was reinstalled. I'm using the following command:
bash
profiles show -o stdout | grep "ProfileDisplayName = "$profileName"" | /usr/bin/awk '{print $3}' | sed 's/s/:punct:]]//g'
This works perfectly for single-word profile names, like "Zoom," but fails with multi-word names, such as "Zoom Profile," resulting in "no such file or directory." I’ve tried enclosing the profile name in both single and double quotes, and using "${profileName}", but nothing seems to work.
Could anyone suggest how to modify the command so it successfully handles profile names with more than one word? Here’s the function I created for verification:
bash
function checkInstall() {
installed=$(profiles show -o stdout | grep "ProfileDisplayName = "$profileName"" | /usr/bin/awk '{print $3}' | sed 's/ed:punct:]]//g')
if "$installed" = "$profileName" ]; then
log "Profile "$profileName" was installed successfully"
elif > "$installed" != "$profileName" ]; then
log "Profile "$profileName" install failed"
fi
}
Thanks for your help!
Regards
Darshan Hiranandani