Functions/RemotePS/Remove-TrustedHosts.ps1

<#
.SYNOPSIS
    Removes one or more computers from the trusted host list.
.DESCRIPTION
    Removes one or more computers from the trusted host list.
.EXAMPLE
    Remove-TrustedHosts -Computer @('192.168.1.100','192.168.1.101')
#>


function Remove-TrustedHosts {
    Param (
        # Hostname, FQDN or IP-address of the trustedhost.
        [Parameter(Mandatory=$true,
                   Position=0,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [string[]] $Computer,

        [switch] $LiteralString
    )
    
    begin {
        [string[]] $TrustedHosts = Get-TrustedHosts
    }
    
    process {
        if (($Computer.Contains('*') -or $Computer.Contains('?') -or $Computer.Contains('[')) -and $LiteralString -eq $false){
            $TrustedHosts = $TrustedHosts | Where-Object {$_ -notlike $Computer}
        }
        $TrustedHosts = $TrustedHosts | Where-Object {$_ -ne $Computer}
    }
    
    end {
        $TrustedHosts | Set-TrustedHosts
    }
}

Export-ModuleMember -Function Remove-TrustedHosts