The -replace '\..*', $domain snippet is in case here's some AD funkiness that returns the FQDN from the external DNS record instead of internal. Some of my labs expose machines to other labs.

Dammit, Jim, I'm a lab admin, not the DNS guru.

function Get-ComputerNameFromTrustedDomain
{
    if (!(Get-Command -Name Get-ADObject))
    {
        Import-Module ServerManager;
        Add-WindowsFeature RSAT;

    } # if (!(Get-Command -Name Get-ADObject))

    Import-Module ActiveDirectory;

    [string[]]$domains = Get-ADObject -Filter {ObjectClass -eq "trustedDomain"} |
        Select-Object -ExpandProperty Name;

    $computerName = $domains |
    % {
        $domain = $_;
        Write-Progress (Get-Date) "Getting FQDNs from $domain";

        (
            Get-ADComputer -Filter * -Server $domain -ResultSetSize $null |
            Select-Object -ExpandProperty DnsHostName
        ) # -replace '\..*', $domain;

    }  # $domains | % {

} # function Get-ComputerNameFromTrustedDomain