Public/Printing/Test-IsDefaultPrinter.ps1
<#
Copyright © 2024 Integris. For internal company use only. All rights reserved. #> FUNCTION Test-IsDefaultPrinter { <# .SYNOPSIS Checks if a specified printer is the default printer. .DESCRIPTION This function checks if a specified printer is the default printer. It compares the name of the specified printer with the name of the default printer and returns a Boolean value indicating whether they match. .PARAMETER PrinterName Specifies the name of the printer to check. .EXAMPLE Test-IsDefaultPrinter -PrinterName "Printer1" Checks if "Printer1" is the default printer. .INPUTS System.String. The function accepts a string input for the printer name. .OUTPUTS System.Boolean. Returns $true if the specified printer is the default printer, otherwise returns $false. .NOTES Ensure you have the necessary permissions to query printer information. #> param ( [string]$PrinterName ) $defaultPrinter = Get-DefaultPrinter return $defaultPrinter.Name -eq $PrinterName } |