Script: Show item info?

obi-k
Valued Contributor II

Hi,

I believe I used to set the "Show item info" preference with a Configuration Profile in the Finder payload. Or the old Global Plist payload.

Can't recall. It doesn't appear there anymore.

Is anybody using a script to check this off?

Screenshot_2022-12-07_at_10_44_02_AM.png

2 ACCEPTED SOLUTIONS

YanW
Contributor III

try this 

 

#!/bin/bash

currentuser=`stat -f "%Su" /dev/console`

## Show Item Info On Desktop
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" /Users/$currentuser/Library/Preferences/com.apple.finder.plist

#Restarts cfprefsd and Finder
killAll cfprefsd
killAll Finder

 

View solution in original post

YanW
Contributor III

Mine is the same except no "" on $currentUser. I also added sleep 2 before killall Finder. Can't remember why I did that but works every time. 

 

#!/bin/sh
currentUser=$(ls -l /dev/console | awk '{print $3}')

sudo -u $currentUser /usr/bin/defaults write /Users/$currentUser/Library/Preferences/.GlobalPreferences.plist AppleShowAllExtensions -bool true

sleep 2

killall Finder

sleep 2

# Jamf Protect Insights check
protectctl checkin --insights

 

View solution in original post

5 REPLIES 5

YanW
Contributor III

try this 

 

#!/bin/bash

currentuser=`stat -f "%Su" /dev/console`

## Show Item Info On Desktop
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" /Users/$currentuser/Library/Preferences/com.apple.finder.plist

#Restarts cfprefsd and Finder
killAll cfprefsd
killAll Finder

 

obi-k
Valued Contributor II

Thanks again, @YanW. Really appreciate it.

Worked nicely.

obi-k
Valued Contributor II

Curious, would you happen to know why this script is failing? Trying to "Show All filename extensions."  Swore this was a Config Profile before.

1) 

#!/bin/bash
 
sudo -u "$currentUser" defaults write NSGlobalDomain AppleShowAllExtensions -bool true
pkill -u "$currentUser" Finder
 
# defaults write /Users/"$currentUser"/Library/Preferences/.GlobalPreferences.plist AppleShowAllExtensions -bool true
 
exit 0

 

2) 

$ sudo -u "$currentUser" /usr/bin/defaults write
/Users/"$currentUser"/Library/Preferences/.GlobalPreferences.plist
AppleShowAllExtensions -bool true
$ sudo killall Finder

 

Screenshot_2022-12-08_at_3_08_10_PM.png

YanW
Contributor III

Mine is the same except no "" on $currentUser. I also added sleep 2 before killall Finder. Can't remember why I did that but works every time. 

 

#!/bin/sh
currentUser=$(ls -l /dev/console | awk '{print $3}')

sudo -u $currentUser /usr/bin/defaults write /Users/$currentUser/Library/Preferences/.GlobalPreferences.plist AppleShowAllExtensions -bool true

sleep 2

killall Finder

sleep 2

# Jamf Protect Insights check
protectctl checkin --insights

 

obi-k
Valued Contributor II

That worked! Thanks again. Curious how you got better at scripting, but I guess that's a JNUC question or something I'd have to ask ya.