Solved

Values of an array into a CAV

Posted on 2013-06-18
4
250 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:
sedgwick earned 500 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

A procedure for exporting installed hotfix details of remote computers using powershell
A brief introduction to what I consider to be the best editor for PowerShell.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

828 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