output is killing me RRS feed

  • Question

  • I am enjoying Powershell so far but continue to have trouble with formatting and routing output.

    Today issue:  I just want to work with the output from Get ADCompter, description.  I need to display it or trim it, or put it in a variable .  

    So lets start here.  What's up with the extra '@{Description=' ?

    Get-ADComputer -Identity $computer -Properties * | Select Description | Out-file  -filepath  "c:\scripts\psout01.txt" -append

    Get-ADComputer -Identity $computer -Properties * | Select Description | Write-host    (output below)

    @{Description=HP8200 (WIN7) RCTraining Workstation 06 (Room R-1246)}

    Thanks for the help   Chuck

    Sunday, August 14, 2016 2:37 AM


  • Use

    Select-Object -ExpandProperty Description

    instead of just

    Select Description

    You don't need  Write-Host .

    -- Bill Stewart [Bill_Stewart]

    • Marked as answer by ChuckAWagner Sunday, August 14, 2016 4:14 AM
    Sunday, August 14, 2016 2:53 AM