[Casper] run command as current user via casper policy?

Clinton Blackmore clinton.blackmore at westwind.ab.ca
Tue Mar 31 07:13:50 PDT 2009


I've attached and pasted FixOfficeDefaults.sh, which does just the  
sort of thing you are looking for.  IIRC, I never did get it to show  
an error in the Casper logs (although you can see that it tries to);  
but, it does find the user and run defaults for them.

Cheers,
Clinton Blackmore



#!/bin/bash

# Applies fixes to MS office so previous formats are used by default
# Based on http://managingosx.wordpress.com/2008/02/13/managing-office-2008/

USERNAME=$3
if [ "$USERNAME" == "" ] ; then
	# script not called at login; find out who is using the computer
	USERNAME=`/usr/bin/w | grep console | awk '{print $1}'`
fi

if [ "$USERNAME" == "" ] ; then
	echo "No one is using the computer; can not set the preference." 1>&2
	exit 1
else
	
	echo "Fixing Office defaults for $USERNAME"
	
	su $USERNAME -c 'defaults write com.microsoft.autoupdate2 HowToCheck  
"Manual"'
	#defaults write com.microsoft.office "2008\\FirstRun\ 
\SetupAssistCompleted" -int 1
	su $USERNAME -c 'defaults write com.microsoft.Word "2008\\Default Save 
\\Default Format" "Doc97"'
	su $USERNAME -c 'defaults write com.microsoft.Excel "2008\\Default  
Save\\Default Format" -int 57'
	su $USERNAME -c 'defaults write com.microsoft.Powerpoint "2008\ 
\Default Save\\Default Save\\Default Format" "Microsoft PowerPoint 98  
Presentation"'
	
	echo "Done."
fi

exit 0





On 31-Mar-09, at 7:44 AM, Thomas Larkin wrote:

> I want to send out a simple one line command to every client  
> machine, but I want it to modify a file in the home directory.
>
> defaults write com.apple.AppleShareClient "afp_cleartext_allow" - 
> bool YES
>
> So, how do I wild card it or loop it to hit every home directory on  
> a machine with out making it a log in hook or what not?
>
> Thanks,
>
> ___________________________
> Thomas Larkin
> TIS Department
> KCKPS USD500
> tlarki at kckps.org
> blackberry:  913-449-7589
> office:  913-627-0351
>
>
>
>
>
> _______________________________________________
> Casper mailing list
> Casper at list.jamfsoftware.com
> http://list.jamfsoftware.com/mailman/listinfo/casper


This email has been scanned by Barracuda Network's Anti-Virus and Spam Firewall.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.jamfsoftware.com/pipermail/casper/attachments/20090331/8b6192f8/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FixOfficeDefaults.sh
Type: application/octet-stream
Size: 1033 bytes
Desc: not available
Url : http://list.jamfsoftware.com/pipermail/casper/attachments/20090331/8b6192f8/attachment.obj 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.jamfsoftware.com/pipermail/casper/attachments/20090331/8b6192f8/attachment-0001.htm 


More information about the Casper mailing list