Public/Printing/Test-PrintSpooler.ps1
<#
Copyright © 2024 Integris. For internal company use only. All rights reserved. #> FUNCTION Test-PrintSpooler { <# .SYNOPSIS Checks the status of the Print Spooler service. .DESCRIPTION This function retrieves the status of the Print Spooler service. If the service is running, it displays a message in green and returns $true. If the service is not running, it displays a message in red and returns $false. .PARAMETER None This function does not take any parameters. .EXAMPLE Test-PrintSpooler Checks if the Print Spooler service is running and displays the status. .INPUTS None. This function does not accept any piped input. .OUTPUTS System.Boolean. Returns $true if the Print Spooler service is running, otherwise returns $false. .NOTES Ensure you have the necessary permissions to query the service status. #> $spooler = Get-Service -Name "Spooler" if ($spooler.Status -eq 'Running') { Write-Host "Print Spooler service is running." -ForegroundColor Green RETURN $true } else { Write-Host "Print Spooler service is not running." -ForegroundColor Red RETURN $false } } |