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