Public/Get-specPrinterFilterContentTag.ps1

function Get-specPrinterFilterContentTag {
    <#
    .SYNOPSIS
    Helper function that classifies the provided printer filter content into predefined tags.
 
    .DESCRIPTION
    The Get-specPrinterFilterContentTag function evaluates the input string representing printer filter content and returns a specific tag based on the content. If the content is empty or null, it returns 'NullOrEmpty'. If the content is 'none', it returns 'None'. Otherwise, it returns 'Printers' for any other input.
    It is used to take the details from an Azure table that contain either a list of printers, 'none' or <null> and classify them into the appropriate tag.
    This is a helper function and may not find many use-cases outside of the specific script it was written for.
 
    .PARAMETER azPrinterFilterContent
    Specifies the printer filter content to be classified. It can be a string that represents printer-related information, or the function will handle special cases for 'none' and empty content.
 
    .EXAMPLES
    # Example 1: Return 'None' when the content is 'none'
    Get-specPrinterFilterContentTag -azPrinterFilterContent 'none'
 
    # Example 2: Return 'NullOrEmpty' when the content is empty
    Get-specPrinterFilterContentTag -azPrinterFilterContent ''
 
    # Example 3: Return 'Printers' for any other content
    Get-specPrinterFilterContentTag -azPrinterFilterContent 'Printer1,Printer2'
 
    .RETURNS
    Returns 'NullOrEmpty', 'None', or 'Printers' based on the input provided.
 
    .NOTES
    Author: owen.heaume
    Version: 1.0 - Initial release
    #>


    [CmdletBinding()]

    param (
        [string]$azPrinterFilterContent
    )

    switch ($azPrinterFilterContent) {
        { [string]::IsNullOrEmpty($_) } { return 'NullOrEmpty' }
        'none' { return 'None' }
        default { return  'Printers' }
    }
}