Solved

Values of an array into a CAV

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

Veeam gives away 10 full conference passes

Veeam is a VMworld 2017 US & Europe Platinum Sponsor. Enter the raffle to get the full conference pass. Pass includes the admission to all general and breakout sessions, VMware Hands-On Labs, Solutions Exchange, exclusive giveaways and the great VMworld Customer Appreciation Part

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 …
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
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…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

626 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