Poweshell - export to csv - weird values RRS feed

  • Question

  • Hi Guys,

    I have followng question. I need to export to CSV list of the open shares in user-computer, but it export to CSV some weird values instead of correct information. 

    I'm using following command:

    net view \\User-computer | export-csv C:\data.csv

    when I use followng command it export proper information to txt file. 

    net view \\User-computer > C:\data.txt

    The issue is, I need to have a data in csv file not txt. What it wrong with my export to csv.? Could you advise ?

    Saturday, January 13, 2018 7:01 PM

All replies

  • You cannot export text to a CSV file.

    net view \\User-computer | Out-File C:\data.txt


    Get-PsDrive | Export-Csv C:\data.csv

    You can save yourself time and frustration by checking the help first.


    Saturday, January 13, 2018 7:30 PM
  • Hi jrv,

    Thanks for response. The issue is that Get-PsDrive command gives me the list drives on my computer, but I need the list of open shares on pointed computer.

    net view command fulfill this needs absolutely. PsDrive not.

    How can I export to CSV data obtained by command net view ?

    Saturday, January 13, 2018 8:57 PM
  • Get-WmiObject Win32_Share -ComputerName somepc


    Saturday, January 13, 2018 9:00 PM
  • You can also do this:

    get-smbshare -CimSession alpha -Special:$false


    Saturday, January 13, 2018 9:03 PM