Solved

Values of an array into a CAV

Posted on 2013-06-18
4
247 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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

920 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now