Control Palo Alto GlobalProtect VPN using AppleScript

I know it's a little strange to still be writing AppleScript in 2023, but this was the best way I found to easily connect and disconnect from a GlobalProtect VPN "automatically". I trigger this from a Keyboard Maestro shortcut, you are free to trigger it any way you wish!

This is a simple script that will toggle the connect/disconnect state of GlobalProtect on macOS. Tested with the latest version of GlobalProtect (v6.2.0-89) and macOS Ventura (13.4.1).:

Toggle GlobalProtect VPN with AppleScript
Tested using macOS Ventura 13.4.1 and GlobalProtect version 6.2.0-89
Written by Trevor Manternach, August 2023.

tell application "System Events" to tell process "GlobalProtect"
  click menu bar item 1 of menu bar 2
  set statusText to name of static text 1 of window 1
  if statusText is "Not Connected" then
    # GlobalProtect is disconnected, so let's connect
    click button "Connect" of window 1
    set entireContents to entire contents of window 1
  else if statusText is "Connected" then
    # GlobalProtect is connected, so let's disconnect
    set windowText to entire contents of window 1
    repeat with theItem in windowText
      if (class of theItem is button) then
        if (value of attribute "AXTitle" of theItem is "Disconnect") then
          # We found a Disconnect button on the main page, let's click it.
          click theItem
          exit repeat
          # We did not find a Disconnect button on the main page, let's hope there is one in the Settings Menu.
          click button "Global Protect Options Menu" of window 1
          click menu item "Disconnect" of menu "Global Protect Options Menu" of button "Global Protect Options Menu" of window 1
          exit repeat
        end if
      end if
    end repeat
  end if
  click menu bar item 1 of menu bar 2
end tell

I also have this hosted as a gist on github. Any changes I make to it are more likely to end up there than here. Comments are welcome over there, too!

Home Assistant Quick Bar

I discovered that Home Assistant has a not-so-recent feature called "Quick Bar" that I somehow missed when it was released in 2020. In short, it allows you to press the e (for entity search) or c (for command search) anywhere in the Home Assistant web interface to access a Spotlight-style search box. This allows you access settings and devices in Home Assistant with just a few keystrokes.


It’s been years since I last paid for an subscription. I just signed up this week ($5/month for 3 months) and it’s been a delight so far. I discovered that you can pretty easily remove the DRM on the audiobook .aax file. I am using Audible Tools to help me create the ffmpeg command to do this.

Another recent discovery is that Overcast, my podcast player of choice, seems to natively support .m4b files (audiobook file format). It even includes artwork and chapters, so it behaves just like most of the podcasts I listen to.

My iPod history

Last month Apple announced the end of the iPod. I thought it might be fun to document my history with the product.


I got my first iPod in March 2005. I believe I bought mine at Best Buy on a weekend trip 350 miles away from home.

Picture of my first iPod

I was listening to a lot of podcasts in those early days and had to use "podcatcher" software because iTunes didn't support podcasts yet. That changed later that year when iTunes 4.9 added podcasts and the rest is history.

I visited that same Best Buy a couple years later when the iPod Touch was released. I remember checking their website and they said they had them in stock, but when I got to the store I couldn't find them. I finally asked and they were still in the back, they went and got one for me.

My first iPod Touch

The iPod Touch was so much fun back then. The iPhone wasn't "in" Montana back then (no joke) and so the Touch was as close as I could get. I remember jailbreaking the thing, and even hanging out in IRC chatrooms trying to troubleshoot my jailbreak attempts. :-D

This past winter I spent ~$100 on new parts to revive my old 4th gen iPod. It now has new life with a fresh battery and an SD card in place of the 20GB spinning hard drive. It's hard to believe a piece of consumer technology from 17 years ago is still alive and well.

I love iPod. It was one of my first adventures into a lifetime of technology.

AdGuard Wildcard DNS with Nginx Proxy Manager

I started using Nginx Proxy Manger at home recently and found a fast and easy way to add internal domains to it. Here is a simple walkthrough.


AdGuard Home setup

In the AdGuard Home web interface, go to Filters->DNS rewrites.

Screenshot of DNS rewrite options on AdGuard Home

Click Add DNS rewrite and enter something like *.home in the domain name field.

Enter the IP address of your NPM host and click Save.

Nginx Proxy Manager

Screenshot of Nginx Proxy Manager

There really isn't anything special to do in NPM. Just add a Proxy Host and in the domain names field you can enter anything as long as it ends in .home (or whatever you chose for a wildcard). www.home even works!

Another little feature I discovered while setting this up is that I can add multiple domain names for each proxy host. So adguard.home and dns.home can both get me to the same place. This helps when I can't remember the name of a service, or when you change software you can keep using something like dashboard.home for your dashboard of choice.

2020 Books I've Read

Killing Kennedy: The End of Camelot
8 hours 25 minutes. Started January 11. Finished January 16th.

Killing Lincoln
7 hours 49 minutes. Started June 7th. Finished June 15th.

True Crimes and Misdemeanors: The Investigation of Donald Trump
496 pages. Started August 18th. Finished October 1st.

Where Law Ends: Inside the Mueller Investigation
432 pages. Started October 1st. Finished October 27th.

Battle for the Big Sky
286 pages. Started October 28th. Finished November 25th.

The Conscience of a Conservative
144 pages. Started November 26th. Finished November 28th.

The War on Normal People
304 pages. Started November 28th. Finished December 2nd.

2019 Books I've Read

Animal Farm
140 pages. Started December 29th. Finished January 9th.

Doing Justice
368 pages. Started April 15th. Finished April 27th.

Pound Foolish
9 hours 7 minutes. Started May 2nd. Finished May 14th.

Everything Is Obvious: *Once You Know the Answer
368 pages. Started May 15th. Finished May 31st.

An Absolutely Remarkable Thing
352 pages. Started June 1st. Finished June 12th.

The President is Missing
527 pages. Started June 16th. Finished June 24th.

Paper Towns
305 pages. Started June 25th. Finished July 9th.

Permanent Record
352 pages. Started December 1st. Finished December 4th.

The Feather Thief: Beauty, Obsession, and the Natural History Heist of the Century
336 pages. Started November 27th. Finished December 13th.

326 pages. Started December 16th. Finished January 9th.

2018 Books I've Read

Evicted. Poverty and Profit in the American City
448 pages. Started April 11th. Finished June 3rd.

A Higher Loyalty: Truth, Lies, and Leadership
312 pages. Started June 3rd. Finished June 11th.

Turtles All The Way Down
304 pages. Started June 12th. Finished June 16th.

The Hellfire Club
9 hours 58 minutes. Started July 6th. Finished July 11th.

Of Mice and Men
112 pages. Started September 3rd. Finished September 7th.

Fear: Trump in the White House
12 hours 20 minutes. Started September 11th. Finished September 17th.

The Old Man and the Sea
128 pages. Started September 22nd. Finished September 25th.

The Tipping Point
8 hours 33 minutes. Started October 15th. Finished December 11th.