Tag: scripting
-
Chrome mid-update versions and Munki
Most of the time, if you want to patch Chrome using Munki, you just use add Chrome as a managed update or managed install to the relevant manifests in your Munki repo, and then have the AutoPkg Chrome.munki recipe import the new version of Chrome into your Munki repo from time to time (daily, weekly,…
-
Scripting changing user icons: dsimport prompts for password in zsh
2 June, 2021 Update Special shoutout to Armin Briegel for pointing out that the zsh version runs just fine if you use a different variable name from USERNAME. I’ve tried it with USERACCOUNT instead, and I’ve confirmed it works fine with zsh. Original Post Apple is moving toward making zsh the default shell instead of…
-
Scripting SSH off/on without needing a PPPC/TCC profile
You used to be able to use /usr/sbin/systemsetup -f -setremotelogin off or /usr/sbin/systemsetup -f -setremotelogin on to script disabling or enabling SSH on macOS. Now that macOS has Privacy Preferences Policy Control, which needs a profile delivered by a user-approved MDM, you may get this error: setremotelogin: Turning Remote Login on or off requires Full…
-
Running commands as a user when scripting for Munki or Jamf
Munki and Jamf run as root, so scripts they execute execute as root, not user. One great way around this is to use Outset‘s login scripts (login-once, login-every), but sometimes you may have occasion to actually run a script immediately as the logged-in user. Obviously, you’ll want to get the currently logged-in user into a…
-
Scripting changing the user picture in macOS
Sometimes, you may want to programmatically set a default user picture (with the option for the user to change it later to a picture of her own choice). You used to be able to delete the JPEGPhoto attribute and just add in a Picture attribute, but that seems to have broken somewhere between October 2018…
-
Using Plistbuddy to delete a string from an array
I have two previous posts about using Plistbuddy to add to an array in a .plist file (specifically Munki’s SelfServeManifest file): Bash script to add optional installs for Munki Terminal command to mark a Munki optional install for installation What if you want to remove an item from the array? It’s not a simple thing…
-
Bash script to add optional installs for Munki
In Terminal command to mark a Munki optional install for installation, I showed a one-off command to mark a Munki optional install item for installation. What if you want to do it in bulk, though? For example, if you’re scripting a thin image to install some software by default, but you want the option for…
-
Scripting enabling root or disabling root on Mac OS X
If you want to script enabling or disabling the root account in Mac OS X (instead of having to go to Directory Utility to do it), you’ll want to use the dsenableroot command. Enable the root user dsenableroot -u adminaccount -p adminaccountpassword -r rootpasswordyouwant Disable the root user dsenableroot -d -u adminaccount -p adminaccountpassword Important…
-
Managing Mac admin user accounts with CreateUserPkg
A lot of Mac admins are ditching “the golden image” (or “monolithic image”) for more thin-imaging + scripting, managing accounts with scripts and packages. Frankly, though, even if you aren’t using AutoDMG (here at SI, we use a combination of “silver image” or “bronze image” that gets subsequently updated with Munki), you may still want…
-
Script enabling/disabling the guest account on OS X
It would appear that you could just enable or disable the guest account by using defaults write in the /Library/Preferences/com.apple.loginwindow.plist file, but apparently that just changes how it displays in System Preferences > Users & Groups. Scripted Solution There is a lot that goes on behind the scenes, and this script actually does it (almost)…
-
Filling out a Google Form from the terminal using the curl command
Cheating a bit here by just linking to someone else’s blog post, but it’s very well written, with screenshots and different colors. Why reinvent the wheel? Here it is: Submit Google Forms By Curl Command
-
Using duti to script default applications for Macs
Back story It was surprisingly difficult for me to find a straightforward tutorial on how to script changing the default applications for Macs. There are great screenshot-laden tutorials on how to change default applications the point-and-click way for one user (right-click the file, Get Info, Open With, select application, Change All, Continue). And then there…