Solved

I'm having trouble exporting a field to a CSV.

Posted on 2011-09-10
2
453 Views
Last Modified: 2012-08-13
Ihave a script that retrieves various properties from my computers and exports them to a csv.

One of the fields is, @{label="Operating System";expression={$_.osname}}

What I should be getting is "Windows Vista™ Enterprise"
But instead when I open the csv the field is "Windows Vista? Enterprise"

When I use Out-File and save the results as txt it works correctly.

How can I get the correct value when exporting the results to a CSV?
0
Comment
Question by:LindyS
[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 Comments
 
LVL 2

Accepted Solution

by:
gazm81 earned 500 total points
ID: 36517860
This is to do with the default encoding of out-file vs csv.
out-file by default goes to unicode and export-csv goes to ascii.

to make export-csv treat ™like out-file

append an option to the export-csv of

-encoding unicode
$variable | export-csv "file.csv" -encoding unicode

Open in new window

0
 
LVL 3

Author Closing Comment

by:LindyS
ID: 36517921
I'm not at work to test this, but it looks like it will do what I need.

Thanks or the information!
0

Featured Post

Ready to trade in that old firewall?

Whether you need to trade-up to a shiny new Firebox or just ready to upgrade from whatever appliance you're using now, WatchGuard has the right appliance for you! Find your perfect Firebox today with appliance sizing tool!

Question has a verified solution.

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

This article will help you understand what HashTables are and how to use them in PowerShell.
A brief introduction to what I consider to be the best editor for PowerShell.
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

622 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