Category filter

Script to set up Printers on macOS devices

Deploying network printers on managed macOS devices is a two-step procedure using scripts. Initially, administrators can use the configuration settings of the printer connected to a wireless network to create scripts. Then, execute these scripts from the Hexnode console to complete the deployment of Wi-Fi/network/Bluetooth printers to Mac.

Disclaimer:

The Sample Scripts provided below are adapted from third-party Open-Source sites.

Deploy printers on Mac

-p specifies the name of the printer

-E enables the printer and accepts jobs

-D sets the system default destination

-v device_uri specifies the device URI for the printer

-m everywhere indicates that the printer is compatible with IPP everywhere

You can also define other printer settings to be applied on macOS devices using the lpadmin command. Type in the command lpadmin in the Terminal to retrieve its entire attribute list.

Notes:


You can obtain the printer’s configuration settings using the lpoptions command.

  1. Open Terminal on a macOS device connected to the given printer.
  2. Type lpoptions.
  3. Press enter.
  4. It displays the printer’s details.


The value listed along with the printer-info corresponds to the destination. The device_uri will be displayed next to the key device-uri.

Remove printers from Mac

-x destination specifies the printer destination to be removed from the device.

Notes:

  • It is recommended to manually validate the script execution on a system before executing the action in bulk.
  • Hexnode will not be responsible for any damage/loss to the system on the behavior of the script.

  • Sample Script Repository