Tag: python
-
Comparing macOS versions using Python
At some point in a Python script, you may want to compare macOS versions (or, really, any software versions) to each other. Back in the day, you could use Python’s LooseVersion from distutils.version, but that’s now deprecated: >>> from distutils.version import LooseVersion >>> LooseVersion(‘14.0.0’) > LooseVersion(‘14.0’) True >>> LooseVersion(‘14.0.0’) == LooseVersion(‘14.0’) False >>> LooseVersion(‘14.0’) >…
-
“looks like a filename, but the file does not exist” error when deploying a Cloud Function
Caveat This fits in the category of “What it ended up being for me, and it may help someone else” and not “I’m an expert on all gcloud errors, and this is always the solution,” so please resist the urge to comment with “This didn’t solve it for me. What’s the solution to my problem?”…
-
How to check the Carbon Black version installed
Update Thanks to Clay Haynes for pointing out you can get the version more easily by running /Applications/VMware\ Carbon\ Black\ EDR.app/Contents/MacOS/CbOsxSensorService -v Back story In Carbon Black 6.3.0 and 7.0.1, it isn’t super obvious how to check for the version installed. For example, if you run defaults read /Applications/VMware\ Carbon\ Black\ EDR.app/Contents/Info.plist, you’ll see CFBundleInfoDictionaryVersion…
-
Updates to the AutoPkgReviewAndRun.py script
3.5 years ago, I created a script to automate running AutoPkg recipes while also verifying trust info and prompting the user to approve or deny any changes. With some prompting from some folks on the #autopkg channel of the MacAdmins Slack, I made a few changes to the script: You can now run the script…
-
Python script to list software available in a Munki repo
I created a small project (for fun) to list out software available in a Munki repo. It’s called MunkiItemsList. On a basic level, it looks for all the items that are listed in any optional installs manifest, and then lists out the display name, description, and highest version available. There are some additional options described…
-
Script to make Jamf Self Service policy install a Munki optional install
There is a huge project called jamJAR that seeks to integrate Munki and Jamf in a seamless way. I’ve written a script that does something a bit less ambitious, but it may still be helpful to your organization if you are “using” Jamf Self-Service, really want to be using Managed Software Center, and still want…
-
Using a Munki nopkg to disable Chrome 80’s ScrollToTextFragment feature
Update, 14 July 2020 With Chrome 84, Google has now removed the ability to disable the ScrollToTextFragment feature, so this whole write-up is now obsolete What is ScrollToTextFragment With Chrome 80, Google has introduced a new ScrollToTextFragment feature that allows you to reference an anchor link by any phrase that’s in a webpage, even if…
-
Script AutoPkg trust verification and trust update process
Starting with version 1, AutoPkg began evaluating trust info for recipes, so you could see what changes were made to a recipe (if changes were made) and then accept the changes if you wanted to. Here is what the typical trust verification workflow looks like. Whether running a list of recipes via script or via…
-
How to read from and write to .plist files using Python
Python and Macs Python is a popular tool among Mac Admins. You can find a fairly comprehensive (and long) list of Python-based Mac Admin tools at Python Macadmin Tools, so it’s a handy thing to be able to throw together a Python script every now and then. .plist files A lot of settings in Mac…
-
Avoiding a .csv error with PrinterGenerator
PrinterGenerator is one of the automated scripts for adding printers to Munki. It’s pretty cool—you just put together a .csv of your printers and their IP addresses, and then run the script on the .csv, and all the pkginfo files for the printers will generate. I did run into one snag, though, which is using…
-
Getting started with pygame on a Mac
There are a lot of pygame tutorials out there, but I haven’t yet found a simple, step-by-step how-to on how to just get pygame installed on a Mac, and then actually use it. So, hopefully, this will work for you. This example was done using Macs running OS X 10.10 (Yosemite). Your mileage may vary.…