Public/Printing/Get-AllPrinters.ps1
<#
Copyright © 2024 Integris. For internal company use only. All rights reserved. #> FUNCTION Get-AllPrinters { <# .SYNOPSIS Retrieves and displays a list of all installed printers. .DESCRIPTION This function retrieves all installed printers on the system. If printers are found, it displays their names in yellow and returns the list of printers. If no printers are installed, it displays a message indicating this and returns $null. .PARAMETER None This function does not take any parameters. .EXAMPLE Get-AllPrinters Retrieves and displays the list of installed printers. .INPUTS None. This function does not accept any piped input. .OUTPUTS System.Object[]. Returns an array of printer objects if printers are installed, otherwise returns $null. .NOTES Ensure you have the necessary permissions to query printer information. #> $printers = Get-Printer if ($printers) { Write-Host "Installed Printers:" -ForegroundColor Yellow $printers | ForEach-Object { Write-Host $_.Name } } else { Write-Host "No printers are installed." } Write-Host "" -ForegroundColor Gray RETURN $printers } |