Posted on 07-30-2017 07:04 PM
Hi jamf nation!
I made a rookie error where by i accidentally deployed a duplicate WiFi by scoping it to All Computers and All Users, i cannot remove this using Exclusion in Scope as it will remove the WiFi at the same time as it uses the Same SSID and password.
Is there a way, script level that i can remove this ?
i tried the following but no luck
#!/bin/bash
## Get UUID of requested MDM Profile
MDMUUID=`profiles -Lv | grep "name: $4" -4 | awk -F": " '/attribute: profileIdentifier/{print $NF}'`
## Remove said profile, identified by UUID
if [[ $MDMUUID ]]; then
profiles -R -p $MDMUUID -u $3
else
echo "No Profile Found"
fi
sleep 5
Thanks
Posted on 07-30-2017 10:13 PM
Is this a user level cert or computer level?
Posted on 07-31-2017 07:38 AM
@rsgrammar Change the first section to look like this
loggedInUser=$(stat -f%Su /dev/console)
MDMUUID=$(profiles -Lv -U $loggedInUser | grep "name: $4" -4 | awk -F": " '/attribute: profileIdentifier/{print $NF}')
The issue is that the profiles -L
command will list installed profiles for the user running the command, OR, you need to specify which user you want it to look at with the -U
flag. Since Jamf Pro scripts run as root, it's looking at System level installed profiles, not user level ones. Hence it's not locating the user profile and exiting without doing any removal.
Also modify that last section to just do this:
profiles -R -p $MDMUUID
IOW, you shouldn't need to add anything to the end of that to my knowledge. Anyway, $3 only resolves to the current user when run as a login/logout trigger or from Self Service. If this is being run with the recurring check in trigger, $3 won't mean anything.