Disable Printer Sharing on macOS using Intune Policy

A guide to turn off the printer sharing on Mac devices using Microsoft Intune.


In this post, I will show you how to disable printer sharing on macOS using Intune policy. Using a DisablePrinterSharing.zsh shell script, you can turn off the macOS printer sharing feature via Microsoft Intune.


When you enable printer sharing on a Mac, it is set up as a print server to accept print jobs from other computers. Apple recommends using a dedicated print server or direct IP printing instead of printer sharing.


An organization recently approached me about stopping Mac users from enabling and using the printer sharing feature. Thankfully, the Mac devices in the enterprise were enrolled in Intune. However, they couldn’t locate a setting to turn off printer sharing for Mac in the settings catalog.


When I did some research, I discovered that there is no option to disable printer sharing for Mac devices in the settings catalog. So, I had to either use a script or a custom template to get this done. Thankfully, Microsoft provides a DisablePrinterSharing.zsh shell script to disable printer sharing, which I used and it worked.

https://www.sportsreptile.site/thread-4790-post-30746.html#pid30746

https://forum.computertech.co/showthread.php?tid=23541

https://rokforall.altervista.org/showthread.php?tid=19562

https://forum.technologyrobone.com/Thread-ykzitb-dtfgfkfge

https://forum.goddesszex.dev/showthread.php?tid=23023

https://www.benjicomehomeweebees.org/mybb/showthread.php?tid=121527

https://global.virtualproleague.com/showthread.php?tid=63

Prerequisites

Ensure that the following prerequisites are met when composing shell scripts and assigning them to macOS devices:


Devices should be running macOS 12.0 or later.

macOS devices must be enrolled and managed by Intune.

The Mac devices are connected directly to the Internet. Connection through a proxy is not supported.

Shell scripts begin with #! and must be in a valid location, such as #!/bin/sh or #!/usr/bin/env zsh.

Command-line interpreters for the applicable shells are installed.

For deploying shell scripts using Intune, refer to my guide on how to run shell scripts on macOS devices in Intune.


Download DisablePrinterSharing.zsh Shell Script

Microsoft provides a shell script called ‘DisablePrinterSharing.zsh‘ that disables printer sharing on Mac devices. Download the latest version of this script from the Intune GitHub repository.


Note: If you are an organization, I don’t recommend deploying this script to your Mac devices without proper testing. You should test the script’s execution on a small number of devices (pilot devices) and then scale up the deployment to a larger number of devices.


Disable Printer Sharing on macOS using Intune Policy

Follow the below steps to upload the DisablePrinterSharing.zsh shell script to Intune and create a policy that will disable printer sharing on macOS devices.

https://forum.ordcom.fr/showthread.php?tid=1187

http://www.xcosmic.net/rsf/showthread.php?tid=206&pid=210

https://forum.haustor.eu/showthread.php?tid=240

https://tictactech.net/forum/showthread.php?tid=103

https://black.volyn.net/forum/viewtopic.php?t=30678

https://black.volyn.net/forum/viewtopic.php?t=38243

Sign in to Microsoft Intune Admin Center.

Navigate to Devices > macOS and select Shell Scripts.

Click the Add button to upload the DisablePrinterSharing.zsh script for macOS.


Enter a name for the profile in the Basics tab of the Add Script pane. Add a brief description about the policy.


For instance, you can enter the following information for the Shell script:


Name: Turn off printer sharing on Mac

http://evtrucksforum.com/viewtopic.php?t=61579

http://evtrucksforum.com/viewtopic.php?t=53282

Description: Disable printing on a macOS that is managed by Intune

Click Next.


On the Script Settings tab, upload the shell script. Click on the Browse icon and select the DisablePrinterSharing.zsh script.


If you’re using a custom script, keep in mind that the macOS shell script file that you upload must be less than 200 KB in size. You can view the script that has been uploaded, but you cannot edit or modify the script at this time.


Scroll down to configure the following script execution settings:

https://black.volyn.net/forum/viewtopic.php?t=54638

https://black.volyn.net/forum/viewtopic.php?t=20462

http://googleseomastermind.com/viewtopic.php?t=22239

http://googleseomastermind.com/viewtopic.php?t=22058

http://googleseomastermind.com/viewtopic.php?t=18746

http://googleseomastermind.com/viewtopic.php?t=16025

Run script as signed-in user: No

Hide script notifications on devices: Yes

Script frequency: Every 1 week

Number of times to retry if script fails: 3 times

Click Next.


On the Assignments tab, you select the Entra ID groups to assign the shell script. The groups you select are shown in the list and will receive your script policy. Click Next.


In the Review + Add tab, a summary of the settings you configured is shown. Select Add to save the script. When you select Add, the script policy is deployed to the macOS device/user groups you chose.


You’ll see a notification “Upload completed for Disable Printer Sharing.zsh” confirming that the script has been uploaded successfully to Intune.


The script and the policy that you created will now appear under the list of scripts. If needed, you can select and view the contents of macOS shell scripts after you upload them to Intune.

https://lumigo.fr/lumiweb-forum-webmarketing/Thread-ohsuregymwearoem-com

http://forofjcruiser.com/viewtopic.php?f=1&t=31973

http://forofjcruiser.com/viewtopic.php?f=1&t=44103

http://forofjcruiser.com/viewtopic.php?f=1&t=99008

http://forofjcruiser.com/viewtopic.php?f=1&t=105844

https://winda.top/viewtopic.php?f=17&t=409930

Next, you must wait for the shell script policy to apply to the targeted groups, and once the macOS devices check in with the Intune service, they will receive the script. You can also run Check Status in company portal on your Mac device to retrieve the latest policies from Intune.


Monitoring the script deployment

Now it’s time to monitor the script deployment on macOS devices and verify that the printer sharing feature is disabled on these devices.


 You can monitor the run status of all assigned macOS scripts for users and devices by choosing one of the following reports in the Intune admin center:

https://winda.top/viewtopic.php?f=17&t=402314

https://winda.top/viewtopic.php?f=17&t=380175

https://winda.top/viewtopic.php?f=17&t=134931

https://forum.webgod.ro/showthread.php?tid=346&pid=1134

http://evtrucksforum.com/viewtopic.php?t=61038

http://evtrucksforum.com/viewtopic.php?t=59911

Shell Scripts > Select the script to monitor > User status.

From the screenshot below, we see the disable printer sharing script has been successfully executed on our Mac devices. This confirms that the script we assigned to disable printer sharing works properly on Mac devices, and if you follow the steps in order, you will get the same results.

Comments

Popular posts from this blog

8 Ways to Fix Windows Update Error 0x80070643

8 Ways to Fix Windows 11 Upgrade Error 0x800F0830-0x20003

Enable/Disable End Task in Taskbar on Windows 11