Cloning and Deploying a Power Manager Schedule

Learn how to clone a Power Manager schedule using the command line tool pmctl.

In this recipe we will walk through cloning an existing Power Manager schedule and deploying it to other Macs. We will do this without Power Manager Professional and instead use Power Manager’s included command line tool pmctl.

Power Manager Control - pmctl

pmctl is a command line tool included with Power Manager. The tool lives within the Power Manager application, /Applications/Power Manager.app/Contents/Tools/pmctl.

The location of pmctl changed in v4.2, when we moved the tool inside of the application bundle. Previously pmctl was part of the Application Support/Power Manager folder; older recipes and documentation may still refer to this location.

The pmctl manual provides more detail about the numerous options and abilities this tool has to offer.

Cloning the Schedule

There are two steps to cloning the Power Manager schedule: extracting the schedule from one Mac and deploying the schedule to many other Macs.

Step 1: Extracting the Schedule

The following steps extract the schedule from Power Manager:

  1. Open Applications > Utilities > Terminal.app
  2. Issue the following command: /Applications/Power\ Manager.app/Contents/Tools/pmctl -f plist eventstore.events > ~/Desktop/schedule.plist

This single command asks pmctl to extract the events from Power Manager and place them into a file on your desktop folder.

Understanding the Command

Let’s look a little closer at the pmctl command we used.

The first part, /Applications/Power\ Manager.app/Contents/Tools/pmctl, is the absolute path and name of the tool we are running.

The option -f plist asks pmctl to format the extracted events in a Property List format, plist. Apple’s Property List format is a form of Extensible Markup Language (XML).

The following text eventstore.events tells pmctl which part of the Power Manager interface we want to read from. In this case, we want all the events from within the event store.

The final part > ~/Desktop/schedule.plist of the command is not for pmctl but instead for the shell. The shell is asked to redirect the output of pmctl to a file on the desktop called schedule.plist.

Step 2: Deploying the Schedule

Next copy the schedule.plist file onto a shared drive or volume where other Macs can read it. For the commands below, we will assume the file is at /Volumes/SharedDrive/schedule.plist.

The following steps deploy the schedule to Power Manager:

  1. Open Applications > Utilities > Terminal.app
  2. Issue the following command: /Applications/Power\ Manager.app/Contents/Tools/pmctl -r eventstore.store -p 'events=(plist:file:///Volumes/SharedDrive/schedule.plist)'

This command asks pmctl to store (read) the events from schedule.plist file.

If you encounter any errors, the response from pmctl will highlight the problem. The most likely problem is with an incorrect file path. The path to the schedule must be absolute and complete.

Understanding the Command

The deployment command is more complex than the previous extraction command.

We already know about the absolute path, and tool name, from the extraction command. So we will skip that part.

That gets us to -r eventstore.store. The -r means request; eventstore.store is the request we are making to Power Manager.

For the the request to be useful, it needs events to work with. The -p means parameter and this provides the events for pmctl to read and pass to Power Manager.

The parameter segment 'events=(plist:file:///Volumes/SharedDrive/schedule.plist)' is frankly intimidating. Let’s break this down further.

Firstly, note the entire parameter is wrapped in single quotes '. This makes it clear where the parameter notation begins and ends.

The events= tells pmctl that the parameter’s name is events. Requests can take multiple parameters, so their names are important.

The (plist: … ) part tells pmctl about the expected format of the events. In this case, they will be encoded as a Property List, plist.

The final part is a URL to the events. In this example, the events are in a file at file:///Volumes/SharedDrive/schedule.plist.

Putting that all back together, we now know the location of the events by URL, their expected format, and the name of the parameter.

Deploying from a Web Server

Did you know you could read the events from a web server? The intimidating parameter format allows for more than reading from files!

In our example above, the parameter could be written as 'events=(plist:https://www.example.com/schedule.plist)'.

Drag and Drop

If you want to avoid the command line for deployment, you can always drag and drop the schedule.plist onto the Power Manager window.

All from the Command Line

This enire process can be performed without physical access to either of the computers involved. You can ssh in to the computer and perform these commands.

Power Manager can be managed entirely through the pmctl tool.