?
Solved

array of names to export to csv

Posted on 2016-11-08
2
Medium Priority
?
53 Views
Last Modified: 2016-11-09
I have an array of names in a variable. When I export to csv the names just come out as a list of numbers. How can I get the list to show up as the names?

$here = "jason","nicole","callie"
$DesktopPath = [Environment]::GetFolderPath("Desktop")
$here | Export-Csv -path $DesktopPath\names.csv -notype


It comes out as Length
5
6
6
0
Comment
Question by:Roccat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Accepted Solution

by:
Roccat earned 0 total points
ID: 41879819
I found my answer.

$here = "jason","nicole","callie"
$here = $here | Select-Object @{Name='Name';Expression={$_}}
$DesktopPath = [Environment]::GetFolderPath("Desktop")
$here | Export-Csv -path $DesktopPath\names.csv -notype
0
 
LVL 70

Expert Comment

by:Qlemo
ID: 41880005
You should just use Out-File instead of Expert-CSV if you want to store string arrays in a file.
A single-column files isn't really a CSV ;-).
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question