[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

array of names to export to csv

Posted on 2016-11-08
2
Medium Priority
?
62 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 71

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

656 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