Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Values of an array into a CAV

Posted on 2013-06-18
4
Medium Priority
?
254 Views
Last Modified: 2013-06-18
Hi, I have the following values in an array but somehow i get unexpected results.

$array0 = HP,HP,Cisco Systems Inc
$array0 | Export-Csv C:\scripts\VMware\Test.csv
I get the following results

Open in new window

"Length"
"2"
"2"
"17"
0
Comment
Question by:namerg
  • 2
4 Comments
 
LVL 42

Accepted Solution

by:
Meir Rivkin earned 2000 total points
ID: 39256757
Export-CSV looks for properties not array contents.
if u want just dump it in csv file then use this:
$array0 = HP,HP,Cisco Systems Inc
$array0 |  sc C:\temp\1.csv

Open in new window

0
 

Author Comment

by:namerg
ID: 39256765
You got it...thank you.
0
 
LVL 40

Expert Comment

by:Subsun
ID: 39256792
Just to expand the above comments, Export-csv read object properties and values and then write it to csv file, In your case it's an array of strings. Export-Csv the cmdlet takes the properties of objects in pipeline which is only Length for strings (“String” | GM), and writes those properties to the csv file.
0
 

Author Comment

by:namerg
ID: 39257049
Hmm, thanks subsun.
0

Featured Post

Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

Question has a verified solution.

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

The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
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…
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…
Screencast - Getting to Know the Pipeline

783 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