Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

MCX Refresh for Mobile Accounts Network
I needed to forcibly refresh the per user mcx for a large number of mobile users across many desktop machines under Snow Leopard so I wrote this short script that will do just that.

Can be run from remote desktop (as root), or locally (sudo). It will not always successfully refresh the mcx, but it will force it to be reloaded from the server on the next logon.

Here's the shell script:
#Brutally refresh mcx for a machine and all mobile accounts on it

#Clear machine cache
dscl . -list Computers | grep -v "^localhost$" | while read computer_name ; do sudo dscl . -delete Computers/"$computer_name" ; done
echo "Cleared machine MCX cache."
#Get a list of locally cached accounts
for usr in `dscl . -list /Users AuthenticationAuthority | grep LocalCachedUser | awk '{print $1}' | tr '\n' ' '`; do
#Clear mcx caches
dscl . -delete /Users/$usr MCXSettings
echo "Cleared MCXSettings for "$usr
dscl . -delete /Users/$usr MCXFlags
echo "Cleared MCXFlags for "$usr
dscl . -delete /Users/$usr cached_groups
echo "Cleared cached groups for "$usr
#Attempt to refresh from server
mcxrefresh -n $usr
echo "Refreshed preferences for "$usr; done

[crarko adds: MCX is the centralized Managed Client for Mac OS X. You use this from OS X Server. Typically this would be found in academic environments for managing shared machines in labs or in Mac-centric enterprises. For more information consult the documentation for OS X Server.]
    •    
  • Currently 3.00 / 5
  You rated: 2 / 5 (4 votes cast)
 
[16,026 views]  

MCX Refresh for Mobile Accounts | 0 comments | Create New Account
Click here to return to the 'MCX Refresh for Mobile Accounts' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.