We're still struggling to get our Macs to register with Intune. After each failed attempt, in addition to removing the partial computer entries from Intune, we have to delete every single file and keychain entry that has anything at all to do with Intune and the Company portal app. After a lot of searching I came up with this script to remove the files associated with it:
#!/bin/sh #variable for storing the current users name assuming the computer has the end user # and not the admin user logged in when this script is run. currentuser=`stat -f "%Su" /dev/console` rm -Rfv /Users/$currentuser/Library/Application Support/com.microsoft.CompanyPortal.usercontext.info rm -Rfv /Users/$currentuser/Library/Application Support/com.microsoft.CompanyPortal rm -Rfv /Users/$currentuser/Library/Application Support/com.jamfsoftware.selfservice.mac rm -Rfv /Users/$currentuser/Library/Saved Application State/com.jamfsoftware.selfservice.mac.savedState rm -Rfv /Users/$currentuser/Library/Saved Application State/com.microsoft.CompanyPortal.savedState rm -Rfv /Users/$currentuser/Library/Preferences/com.microsoft.CompanyPortal.plist rm -Rfv /Users/$currentuser/Library/Preferences/com.jamfsoftware.selfservice.mac.plist rm -Rfv /Users/$currentuser/Library/Preferences/com.jamfsoftware.management.jamfAAD.plist rm -Rfv /Users/$currentuser/Library/Cookies/com.microsoft.CompanyPortal.binarycookies rm -Rfv /Users/$currentuser/Library/Cookes/com.jamf.management.jamfAAD.binarycookies
I am having a helluva time trying to figure out how to automate the removal of the keychain items. There are so many and I can't make heads or tails out of the
security command. So far I have found the following in the current user's Login keychain that seem to have anything to do with Intune:
I would prefer to use a surgical methodology to only remove the Intune-specific Keychain entries and leave the user's other keychain items untouched. I don't know where to begin. I've spent weeks trying to figure out how to use the
security command but I'm getting nowhere. Does anyone else have a way to automate this?
Solved! Go to Solution.
The only other thing I've done was to upgrade from JamfPro 10.9.0 to 10.13.0, but I suspect Mojave 10.14.6 doesn't like some of the security commands.
In the log, after the part where it deletes the Application Support and Preference files it says this:
Remove keychain password items security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain. [message repeats 9 times] delete-identity: option requires an argument -- Z Usage: delete-identity [-c name] [-Z hash] [-t] [keychain...] -c Specify certificate to delete by its common name -Z Specify certificate to delete by its SHA-1 hash value -t Also delete user trust settings for this identity certificate The identity to be deleted must be uniquely specified either by a string found in its common name, or by its SHA-1 hash. If no keychains are specified to search, the default search list is used. Delete an identity (certificate + private key) from a keychain.