Functions/RemotePS/Add-TrustedHost.ps1

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


function Add-TrustedHosts {
    Param (
        # Hostname, FQDN or IP-address of the trustedhost.
        [Parameter(Mandatory=$true,
                   Position=0,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [string[]] $Computer
    )
    
    begin {
        [string[]] $TrustedHosts = Get-TrustedHosts
    }
    
    process {
        $TrustedHosts += $Computer
    }
    
    end {
        $TrustedHosts | Set-TrustedHosts
    }
}

Export-ModuleMember -Function Add-TrustedHosts