Posted on 10-15-2015 03:12 PM
So, when our company moved into it's new digs, a .mobileconfig profile had to be installed first day. Not everyone got it, and it turns out that it's the source of some problems.
I have a new .mobileconfig file that's been distributed and is working much better, yea.
The 40 or so users that now have 2 .mobileconfig files I need to get the old one removed.
I can run as root over ARD that lets me know if the user has the old .mobileconfig file.
! /usr/bin/profiles -P |grep "OMC 802.1X"
Not sure how to get Casper to run that and give me a report of just the users that have that profile, but if that's possible, that would be great.
Then I need to remove the profile. That's tougher, the Profile was originally added as the User account, not the Admin or root account. So, I can't use root to remove it. Is it possible to use Casper to remove a .mobileconfig profile in /usr/bin/profiles that is attributed to a username[1] and not _computerlevel[1]
I can do this manually it's not hard, but if it's possible to have Casper,
Who has the old profile.
Can remove the old profile.
That would be really helpful...
Thanks.
Posted on 10-15-2015 03:49 PM
Here is a script I used to find a WiFi profile based on it's name older than a certain date and remove it if found.
You might be able to pick through the code and find something that would allow you to find and remove a differently named profile. Even just the profiles query might help you to isolate the name and give you the list need.
#!/bin/bash
#Global Variable
STALE_DATE="2015-01-19"
STALE_DATE=$(echo $STALE_DATE | sed 's/[^0-9]*//g')
WIFI_NAME="INSERT YOUR PROFILE NAME HERE"
WIFI_PROFILES=$(Profiles -Lv | awk '/attribute: name:/ && /'$WIFI_NAME'/,/attribute: profileIdentifier:/' | awk '/attribute: profileIdentifier:/ {print $4}')
for WIFI_PROFILE in $WIFI_PROFILES
do
echo Profile: $WIFI_PROFILE
WIFI_DATE=$(Profiles -Lv | sort -r | awk '/attribute: profileIdentifier: '$WIFI_PROFILE'/,/attribute: installationDate:/' | awk '/attribute: installationDate:/ {print $4}')
echo Install: $WIFI_DATE
WIFI_DATE=$(echo $WIFI_DATE | sed 's/[^0-9]*//g')
if [ $WIFI_DATE -lt $STALE_DATE ]
then
echo The profile "$WIFI_PROFILE" is STALE
echo Attempting to remove stale profile
profiles -R -p "$WIFI_PROFILE"
else
echo The profile "$WIFI_PROFILE" is CURRENT
fi
done
exit 0