"write defaults" script not running properly.

Johnny_Kim
Contributor II

Hey all,
Theres a command I am trying to use as a script but for some reason, it doesn't run. JSS shows the policy as successful.

#!/bin/sh
defaults write /Library/Preferences/com.apple.NetworkAuthorization UseShortName -bool YES

We have tried running this script at logon and startup to no avail.

Thanks in advance!

1 ACCEPTED SOLUTION

jdziat
Contributor

Maybe try something like this out

#! /bin/sh
sudo defaults write /Library/Preferences/com.apple.NetworkAuthorization UseShortName -bool YES;
if [ -f '/Library/Preferences/com.apple.NetworkAuthorization.plist' ] then exit 0;
fi exit 1;

View solution in original post

3 REPLIES 3

jdziat
Contributor

Maybe try something like this out

#! /bin/sh
sudo defaults write /Library/Preferences/com.apple.NetworkAuthorization UseShortName -bool YES;
if [ -f '/Library/Preferences/com.apple.NetworkAuthorization.plist' ] then exit 0;
fi exit 1;

jdziat
Contributor
#! /bin/sh
sudo defaults write /Library/Preferences/com.apple.NetworkAuthorization UseShortName -bool YES;
if [ -f '/Library/Preferences/com.apple.NetworkAuthorization.plist' ] 
then 
exit 0;
fi 
exit 1;

Sorry about that and the double post. You should be able to set up a managed preference for that as well

Johnny_Kim
Contributor II

Sorry,
Sandy shut our district down for a week. The script seemed to work. Thanks jdziat!