Solved

Values of an array into a CAV

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Microsoft Windows Server Update Service (WSUS) is free for everyone, but it lacks of some desirable features like send an e-mail to the administrator with the status of all computers on the WSUS server. This article is based on my PowerShell script …
In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

747 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

10 Experts available now in Live!

Get 1:1 Help Now