My calculated Properties

I’m trying to convert PSCOMPUTERNAME to DC with this

$DCs = [DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest() |
    Select-Object -ExpandProperty Sites |
        Select-Object -ExpandProperty Servers |
            Select-Object -ExpandProperty Name

    Invoke-Command -ComputerName $DCs {
        Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full'} |
           Sort-Object -Property PSComputerName |  select @{ Name ='DC'; Expression = {PSComputerName}},version 

but my results are empty.

What am I doing incorrectly?

This is how it is. $_ is missing.

@{ Name ='DC'; Expression = {$_.PSComputerName}}
3 Likes