Posted on 06-16-2011 05:32 PM
Any Teamviewer users out there?
I would like to grab the ClientID from the Teamview plist
Its the 2nd key in the dictionary.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ClientIC</key>
<integer>1869728100</integer>
<key>ClientID</key>
<integer>262023163</integer>
The path to the file is:
~/Library/Preferences/com.TeamViewer.Settings.plist
sed and awk are not my closest friends.
--
Doug Hanley doug at mac-tek.com - 702-396-0697
Apple Certified Systems Administrator - Apple Certified Trainer
Apple Certified Support Professional - Apple Certified Technical Coordinator
MacTEK Consulting & Training - http://www.Mac-TEK.com
Apple Authorized Training Center (IT & Pro Apps) - Adobe Authorized Training Center
Apple Consultants Network Member - Apple Authorized Service Provider
Posted on 06-16-2011 06:05 PM
PlistBuddy -c "Print :ClientID"
~/Library/Preferences/com.TeamViewer.Settings.plist
- Justin Rummel
Posted on 06-16-2011 06:07 PM
Should be something like:
defaults read ~/Library/Preferences/com.TeamViewer.Settings ClientID
Justin
Posted on 06-16-2011 08:44 PM
Yeah that's the issue. Defaults Read won't get it from the current logged in user.
On Jun 16, 2011, at 5:43 PM, David Moyle wrote:
I think its back to greping the plist from the path ~/Library/Preferences...
--
Doug Hanley doug at mac-tek.com - 702-396-0697
Apple Certified Systems Administrator - Apple Certified Trainer
Apple Certified Support Professional - Apple Certified Technical Coordinator
MacTEK Consulting & Training - http://www.Mac-TEK.com
Apple Authorized Training Center (IT & Pro Apps) - Adobe Authorized Training Center
Apple Consultants Network Member - Apple Authorized Service Provider
Posted on 06-16-2011 09:41 PM
Casper scripts run as root so you either need to use some sort of
current user detection or loop through all users to store the info.
Posted on 06-17-2011 10:27 AM
A bunch of recent posts have explained how to grab the current user:
ls -l /dev/console | awk '{print $3}'
Beware, if you run the defaults command as root, then you will change the ownership and group of that file to root instead. If you wish to run a command as a user then you can use something like:
su [username] -c 'defaults write ~/Library/Preferences/com.apple.iTunes invertStoreLinks -bool yes'
will edit the com.apple.iTunes.plist file for [username], maintaining ownership to [username].
Sean
Posted on 06-17-2011 11:00 AM
for username in /Users/; do
if [[ -a "${username}/Library/Preferences/com.TeamViewer.Settings.plist"
]]; then
clientid=$(PlistBuddy -c "Print :ClientID"
~/Library/Preferences/com.TeamViewer.Settings.plist)
echo "<result>${username##/} has the ClientID ${clientid}</result>"
else
echo "<result>${username##*/} has no ClientID</result>"
fi
done
Came up with that quick and dirty...should work, have not tested with
another plist. If you dont want /Users/Shared muddying up the outcome
you can iterate over the UID > 500 per Larkin's now famous one-liner.
It can be found all over the place ;) That would change the path for
the test and also wouldn't need the bash string manipulation to get
just the name by itself though.
Good luck,
Ryan M. Manly
Glenbrook High Schools
Posted on 06-17-2011 11:03 AM
ack! This
clientid=$(PlistBuddy -c "Print :ClientID"
~/Library/Preferences/com.TeamViewer.Settings.plist)
needs to be
clientid=$(PlistBuddy -c "Print :ClientID"
"${username}/Library/Preferences/com.TeamViewer.Settings.plist")
Ryan M. Manly
Glenbrook High Schools