There are multiple ways how you can add a network printer to a PC and of course you can do that also with Compliance Settings in Configuration Manager. In PowerShell we can use Add-Printer cmdlet and if you don’t have the latest PowerShell version, then you can use Win32_Printer WMI class to add the Printer. If you don’t want to depend on a specific PowerShell version, then maybe the easiest way is to use Win32_Printer WMI Class.

Here are the scripts/cmdlets that you can use

Discovery Scripts

Option 1

Win32_Printer WMI Class query

Get-WmiObject -Class Win32_Printer -Filter "Name=’\\\\CTTERM\\CTColorPrint01’" | Measure-Object | Select-Object -ExpandProperty Count

Option 2

Get-Printer cmdlet

Get-printer -Name "\\ctterm\CTColorPrint01" -ErrorAction SilentlyContinue | Measure-Object | Select-Object -ExpandProperty Count

Remediation Scripts

Option 1

AddPrinterConnection method in Win32_Printer WMI class

Invoke-WmiMethod -Namespace "root\cimv2" -Class Win32_Printer -Name AddPrinterConnection -ArgumentList \\CTTERM\CTColorPrint01

Option 2

Add-Printer cmdlet

Add-Printer -ConnectionName \\ctterm\CTColorPrint01

Create the Compliance rule in Configuration Manager

1. Launch the Configuration Manager console, navigate to the Assets and Compliance workspace, Compliance Settings, Configuration Items.

2. Create a new Configuration Item, Select Windows and click Next.

clip_image001

3. Select all Operating systems, and click Next.

4. On Settings, click New. In Setting type, select Script and in Data select Boolean

clip_image003

5. On Discovery Script, click Edit Script and set the Script Language to Windows PowerShell

clip_image005

6. On Create Remediation Script, click Edit Script and set the Script Language to Windows PowerShell

clip_image007

7. Enable “Run scripts by using the logged on user credentials” checkbox

clip_image009

8. Select the Compliance Rule tab, and click New. Configure the following values and click OK.

clip_image011

9. Finish the wizard.

10. Create a new Baseline, and add the Color Printer Configuration Item.

clip_image013

11. Deploy the baseline to a User collection

12. Log in to test computer with a standard user account and evaluate the rule

clip_image015

13. Check the Printers

image

As you see it´s really easy to add network printers with Compliance settings.