Just some questions. Why the in front of AllowGuestAccess in your script? I don't understand why that would be needed. When using defaults to read that back you shouldn't need to escape that. Or am I the one missing something?
Also, why do you need to check what it finds against a desired value in the EA itself? The Extension Attribute should simply be returning a result, which you can then use to create Smart Groups to take some action, like dropping a machine into scope of your MCX setting. Its not like you'd be looking for the script in the EA to take some action on the machine if it doesn't find the desired value. It really just plugs a value into the db. Taking an action is what a policy would be for.
Does something simpler like this work?
#!/bin/sh
GuestAccess=`/usr/bin/defaults read /Library/Preferences/SystemConfiguration/com.apple.smb.server AllowGuestAccess 2> /dev/null`
echo $GuestAccess
if [[ $GuestAccess == 0 ]]; then
echo "<results>Disabled</result>"
elif [[ $GuestAccess == 1 ]]; then
echo "<result>Not Disabled</result>"
elif [[ $GuestAccess == "" ]]; then
echo "<result>Unknown</result>"
fi
Forgive me if I'm overlooking something.