locked
Export-CSV vs > RRS feed

  • Question

  • When using the following I get a .csv file listing computer names.

    Get-ADComputer -Filter * -SearchBase "OU=Computers, OU=Production, DC=prod, DC=root, DC=net"* | Select-Object Name >.\AllComputers.txt

    When I use the following I get a list only showing numerical list of computer name length.

    Get-ADComputer -Filter * -SearchBase "OU=Computers, OU=Production, DC=prod, DC=root, DC=net"* | Select-Object Name  | Export-CSV .\AllComputers.csv

    How do I get the correct computer list when using Export-CSV?

    Wednesday, June 20, 2018 3:15 AM

All replies

  • Nothing will work with the "*" at the end of the search string.


    \_(ツ)_/

    • Proposed as answer by I.T Delinquent Wednesday, June 20, 2018 8:38 AM
    Wednesday, June 20, 2018 3:51 AM
  • I agree with jrv, it should work fine once you remove the asterisk after the DC=net" .

    Get-ADComputer -Filter * -SearchBase "OU=Computers, OU=Production, DC=prod, DC=root, DC=net" | Select-Object Name | Export-CSV .\AllComputers.csv

    Wednesday, June 20, 2018 8:25 AM